Skip to content

Commit 0ab178e

Browse files
authored
style: commitlint (chimurai#249)
* chore: add commit linting * style(standard): update to standard v11.x * chore(package.json): update versions
1 parent 66396d4 commit 0ab178e

File tree

13 files changed

+8197
-70
lines changed

13 files changed

+8197
-70
lines changed

examples/browser-sync/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var proxy = require('../../index') // require('http-proxy-middleware');
99
*/
1010
var jsonPlaceholderProxy = proxy('/users', {
1111
target: 'http://jsonplaceholder.typicode.com',
12-
changeOrigin: true, // for vhosted sites, changes host header to match to target's host
12+
changeOrigin: true, // for vhosted sites, changes host header to match to target's host
1313
logLevel: 'debug'
1414
})
1515

examples/connect/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var proxy = require('../../index') // require('http-proxy-middleware');
1010
*/
1111
var jsonPlaceholderProxy = proxy({
1212
target: 'http://jsonplaceholder.typicode.com',
13-
changeOrigin: true, // for vhosted sites, changes host header to match to target's host
13+
changeOrigin: true, // for vhosted sites, changes host header to match to target's host
1414
logLevel: 'debug'
1515
})
1616

examples/express/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var proxy = require('../../index') // require('http-proxy-middleware');
99
*/
1010
var jsonPlaceholderProxy = proxy({
1111
target: 'http://jsonplaceholder.typicode.com',
12-
changeOrigin: true, // for vhosted sites, changes host header to match to target's host
12+
changeOrigin: true, // for vhosted sites, changes host header to match to target's host
1313
logLevel: 'debug'
1414
})
1515

examples/websocket/index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ var proxy = require('../../index') // require('http-proxy-middleware');
99
*/
1010
var wsProxy = proxy('/', {
1111
target: 'http://echo.websocket.org',
12-
// pathRewrite: {
13-
// '^/websocket' : '/socket', // rewrite path.
14-
// '^/removepath' : '' // remove path.
15-
// },
16-
changeOrigin: true, // for vhosted sites, changes host header to match to target's host
17-
ws: true, // enable websocket proxy
12+
// pathRewrite: {
13+
// '^/websocket' : '/socket', // rewrite path.
14+
// '^/removepath' : '' // remove path.
15+
// },
16+
changeOrigin: true, // for vhosted sites, changes host header to match to target's host
17+
ws: true, // enable websocket proxy
1818
logLevel: 'debug'
1919
})
2020

2121
var app = express()
22-
app.use('/', express.static(__dirname)) // demo page
23-
app.use(wsProxy) // add the proxy to express
22+
app.use('/', express.static(__dirname)) // demo page
23+
app.use(wsProxy) // add the proxy to express
2424

2525
var server = app.listen(3000)
26-
server.on('upgrade', wsProxy.upgrade) // optional: upgrade externally
26+
server.on('upgrade', wsProxy.upgrade) // optional: upgrade externally
2727

2828
console.log('[DEMO] Server: listening on port 3000')
2929
console.log('[DEMO] Opening: http://localhost:3000')

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function HttpProxyMiddleware (context, opts) {
142142
}
143143

144144
function logError (err, req, res) {
145-
var hostname = (req.headers && req.headers.host) || (req.hostname || req.host) // (websocket) || (node0.10 || node 4/5)
145+
var hostname = (req.headers && req.headers.host) || (req.hostname || req.host) // (websocket) || (node0.10 || node 4/5)
146146
var target = proxyOptions.target.host || proxyOptions.target
147147
var errorMessage = '[HPM] Error occurred while trying to proxy request %s from %s to %s (%s) (%s)'
148148
var errReference = 'https://nodejs.org/api/errors.html#errors_common_system_errors' // link to Node Common Systems Errors page

lib/logger.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var loggerInstance
55

66
var defaultProvider = {
77
log: console.log,
8-
debug: console.log, // use .log(); since console does not have .debug()
8+
debug: console.log, // use .log(); since console does not have .debug()
99
info: console.info,
1010
warn: console.warn,
1111
error: console.error

lib/router.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ function getTargetFromProxyTable (req, table) {
2727

2828
_.forIn(table, function (value, key) {
2929
if (containsPath(key)) {
30-
if (hostAndPath.indexOf(key) > -1) { // match 'localhost:3000/api'
30+
if (hostAndPath.indexOf(key) > -1) { // match 'localhost:3000/api'
3131
result = table[key]
3232
logger.debug('[HPM] Router table match: "%s"', key)
3333
return false
3434
}
3535
} else {
36-
if (key === host) { // match 'localhost:3000'
36+
if (key === host) { // match 'localhost:3000'
3737
result = table[key]
3838
logger.debug('[HPM] Router table match: "%s"', host)
3939
return false

0 commit comments

Comments
 (0)