[fix] closes number #487

This commit is contained in:
yawnt 2013-11-07 19:05:59 +01:00
parent 590bb604da
commit cde08fb2ee

View File

@ -20,24 +20,23 @@ var http = require('http'),
*/
proxy.createProxyServer = proxy.createServer = function createProxyServer(options) {
if(!options) {
throw new Error([
"`options` is needed and it must have the following layout:",
" ",
" { ",
" target : <url string to be parsed with the url module> ",
" forward: <url string to be parsed with the url module> ",
" agent : <object to be passed to http(s).request> ",
" ssl : <object to be passed to https.createServer()> ",
" ws : <true/false, if you want to proxy websockets> ",
" xfwd : <true/false, adds x-forward headers> ",
" } ",
" ",
"NOTE: `options.ws` and `options.ssl` are optional. ",
" `options.target and `options.forward` cannot be ",
" both missing "
].join("\n"));
}
/*
* `options` is needed and it must have the following layout:
*
* {
* target : <url string to be parsed with the url module>
* forward: <url string to be parsed with the url module>
* agent : <object to be passed to http(s).request>
* ssl : <object to be passed to https.createServer()>
* ws : <true/false, if you want to proxy websockets>
* xfwd : <true/false, adds x-forward headers>
* }
*
* NOTE: `options.ws` and `options.ssl` are optional.
* `options.target and `options.forward` cannot be
* both missing
* }
*/
return new httpProxy.Server(options);
};