Skip to content

Commit

Permalink
fix: createAnonymousContext add host in headers (#3477)
Browse files Browse the repository at this point in the history
  • Loading branch information
dead-horse authored and fengmk2 committed Feb 19, 2019
1 parent 5952d12 commit a2f0d96
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/egg.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ class EggApplication extends EggCore {
createAnonymousContext(req) {
const request = {
headers: {
host: '127.0.0.1',
'x-forwarded-for': '127.0.0.1',
},
query: {},
Expand Down
1 change: 1 addition & 0 deletions test/lib/egg.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ describe('test/lib/egg.test.js', () => {
it('should create anonymous context', async () => {
let ctx = app.createAnonymousContext();
assert(ctx);
assert(ctx.host === '127.0.0.1');
ctx = app.agent.createAnonymousContext();
assert(ctx);
});
Expand Down

0 comments on commit a2f0d96

Please sign in to comment.