http-intercept
Intercepts node http.request. Allows conditional request modification.
Install
Install with npm
$ npm i http-intercept --save-dev
Usage
const httpIntercept = ; const options = hostname: 'google.com' port: 80 path: '/upload' method: 'get' headers: 'Content-Type': 'application/x-www-form-urlencoded' ; const interceptOptions = searchValue: 'google' replaceValue: 'bing' { // newOptions.hostname ==='bing.com } ; ; http;
const httpIntercept = ; const options = hostname: 'google.com' port: 80 path: '/upload' method: 'get' headers: 'Content-Type': 'application/x-www-form-urlencoded' ; const interceptOptions = searchValue: 'google' replaceValue: 'bing' { // newOptions is unchanged because predicate fails. } false ; ; http;
const httpIntercept = ; const options = hostname: 'google.com' port: 80 path: '/upload' method: 'get' headers: 'Content-Type': 'application/x-www-form-urlencoded' ; const interceptOptions = searchAndReplaceValues: google: 'bing' '.com': '.org' { // hostname is now 'bing.org' } ; ; http;
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Author
Jeff Wilde
License
Copyright © 2017 Jeff Wilde Licensed under the (MIT OR Apache-2.0) license.
This file was generated by readme-generator on January 26, 2017.