mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
[fix] style nits
This commit is contained in:
parent
220f5fb795
commit
d0f1dfeb82
@ -1,4 +1,4 @@
|
||||
//use explicit /index.js to help browserify negociation in require '/lib/http-proxy' (!)
|
||||
// Use explicit /index.js to help browserify negociation in require '/lib/http-proxy' (!)
|
||||
var ProxyServer = require('./http-proxy/index.js').Server;
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ var ProxyServer = require('./http-proxy/index.js').Server;
|
||||
*/
|
||||
|
||||
|
||||
var createProxyServer = function(options) {
|
||||
function createProxyServer(options) {
|
||||
/*
|
||||
* `options` is needed and it must have the following layout:
|
||||
*
|
||||
@ -35,7 +35,7 @@ var createProxyServer = function(options) {
|
||||
* ignorePath: <true/false, Default: false - specify whether you want to ignore the proxy path of the incoming request>
|
||||
* localAddress : <Local interface string to bind for outgoing connections>
|
||||
* changeOrigin: <true/false, Default: false - changes the origin of the host header to the target URL>
|
||||
* auth : Basic authentication i.e. 'user:password' to compute an Authorization header.
|
||||
* auth : Basic authentication i.e. 'user:password' to compute an Authorization header.
|
||||
* hostRewrite: rewrites the location hostname on (301/302/307/308) redirects, Default: null.
|
||||
* autoRewrite: rewrites the location host/port on (301/302/307/308) redirects based on requested host/port. Default: false.
|
||||
* protocolRewrite: rewrites the location protocol on (301/302/307/308) redirects to 'http' or 'https'. Default: null.
|
||||
|
||||
@ -28,7 +28,7 @@ module.exports = {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
deleteLength : function deleteLength(req, res, options) {
|
||||
deleteLength: function deleteLength(req, res, options) {
|
||||
if((req.method === 'DELETE' || req.method === 'OPTIONS')
|
||||
&& !req.headers['content-length']) {
|
||||
req.headers['content-length'] = '0';
|
||||
@ -62,7 +62,7 @@ module.exports = {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
XHeaders : function XHeaders(req, res, options) {
|
||||
XHeaders: function XHeaders(req, res, options) {
|
||||
if(!options.xfwd) return;
|
||||
|
||||
var encrypted = req.isSpdy || common.hasEncryptedConnection(req);
|
||||
@ -94,7 +94,7 @@ module.exports = {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
stream : function stream(req, res, options, _, server, clb) {
|
||||
stream: function stream(req, res, options, _, server, clb) {
|
||||
|
||||
// And we begin!
|
||||
server.emit('start', req, res, options.target)
|
||||
|
||||
@ -23,7 +23,7 @@ module.exports = { // <--
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
removeChunked : function removeChunked(req, res, proxyRes) {
|
||||
removeChunked: function removeChunked(req, res, proxyRes) {
|
||||
if (req.httpVersion === '1.0') {
|
||||
delete proxyRes.headers['transfer-encoding'];
|
||||
}
|
||||
@ -82,7 +82,7 @@ module.exports = { // <--
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
writeHeaders : function writeHeaders(req, res, proxyRes, options) {
|
||||
writeHeaders: function writeHeaders(req, res, proxyRes, options) {
|
||||
var rewriteCookieDomainConfig = options.cookieDomainRewrite;
|
||||
if (typeof rewriteCookieDomainConfig === 'string') { //also test for ''
|
||||
rewriteCookieDomainConfig = { '*': rewriteCookieDomainConfig };
|
||||
@ -107,7 +107,7 @@ module.exports = { // <--
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
writeStatusCode : function writeStatusCode(req, res, proxyRes) {
|
||||
writeStatusCode: function writeStatusCode(req, res, proxyRes) {
|
||||
// From Node.js docs: response.writeHead(statusCode[, statusMessage][, headers])
|
||||
if(proxyRes.statusMessage) {
|
||||
res.writeHead(proxyRes.statusCode, proxyRes.statusMessage);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user