https://github.com/tomnomnom/george
HTTP Debugging Proxy
https://github.com/tomnomnom/george
Last synced: about 2 months ago
JSON representation
HTTP Debugging Proxy
- Host: GitHub
- URL: https://github.com/tomnomnom/george
- Owner: tomnomnom
- Created: 2012-04-18T19:29:18.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2012-04-18T22:42:04.000Z (about 13 years ago)
- Last Synced: 2025-01-24T09:08:31.811Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 102 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.mkd
Awesome Lists containing this project
README
# george - HTTP debugging proxy
A really basic HTTP proxy written in node.js with hooks to let you re-write headers on request and response.
## A word of warning
If there were a greek letter before alpha then it would describe the state of george. If george was a real
person he would randomly refuse to do perfectly reasonable tasks that you ask of him.## Methods
* `george.listen(port)` - start the proxy server listening on a port (default: 7070)
* `george.rewriteUrl(search, replace)` - rewrite requests from `search` to `replace`
* `george.on(event, callback)` - bind a callback to an event### Events
* `request` - emitted before a request is made. A request object is the only argument.
* `response` - emitted after a response is received, but before it is sent to the client. A response object is the only argument.## Examples
The most basic usage:
var george = require('george');
george.listen(7070);A more complex example:
var george = require('george');
// Log the URL being requested
george.on('request', function(request){
console.log(request.url);
});george.on('response', function(response){
// Globally replace "monospace" with "sans-serif" in the response body
response.body = response.body.replace(/monospace/g, 'sans-serif');// Change the content-type to be text/plain
response.headers['content-type'] = 'text/plain';
});// Start George listening on port 7070
george.listen(7070);## Known issues
* There is currently no guarantee that callbacks run in time if they're async
* Gzip et al is not supported
* SSL isn't supported either
* Non-text data is not support in general