-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
server.fallback proxy.disabled proxies[].cache.enabled
- Loading branch information
Showing
12 changed files
with
111 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Changelog | ||
|
||
### 0.0.1 (in progress) | ||
### 0.0.1 | ||
|
||
- changes in 0.0.1.... what can they be ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* eslint-env mocha */ | ||
|
||
const assert = require('assert'); | ||
const request = require('supertest'); | ||
const mockFs = require('mock-fs'); | ||
const fakeConfig = require('./testingConfig'); | ||
const fs = require('fs'); | ||
|
||
describe('caching', function () { | ||
let server, proxyServer; | ||
const fsSystem = {}; | ||
beforeEach(function () { | ||
fakeConfig({ | ||
proxies: [{ | ||
contextPath: '/api', | ||
cache: { | ||
enabled: true, | ||
}, | ||
}], | ||
}); | ||
|
||
// server ? undefined : server.close(); | ||
proxyServer = { | ||
web: function (req, res) { | ||
res.send(200, 'REVERSE RESPONSE SUCCESS'); | ||
}, | ||
}; | ||
server = require('../src/server')(proxyServer); | ||
mockFs(fsSystem); | ||
}); | ||
afterEach(function () { | ||
server.close(); | ||
proxyServer = null; | ||
mockFs.restore(); | ||
}); | ||
|
||
it('should create cached file', function testSlash() { | ||
return request(server) | ||
.get('/api/abb-cc') | ||
.send('aaa') | ||
.expect(200) | ||
.then(response => { | ||
const a = fs.readFileSync('./FAKE_MOCK_DIR/api/GET/abb-cc#f007732d.html').toString(); | ||
assert.equal(response.text, 'REVERSE RESPONSE SUCCESS'); | ||
assert.equal(a, response.text); | ||
}); | ||
|
||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const config = require('../src/config'); | ||
const fakeConfig = { | ||
mock: './FAKE_MOCK_DIR/', | ||
server: { | ||
port: 9999, | ||
}, | ||
log: 'ALL', | ||
}; | ||
Object.assign(config, fakeConfig); | ||
|
||
module.exports = function (newConfig) { | ||
Object.assign(config, newConfig); | ||
}; |