Skip to content

Commit

Permalink
feat: add a header
Browse files Browse the repository at this point in the history
  • Loading branch information
Yihang Li committed Oct 25, 2018
1 parent 5a589c9 commit c926325
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ module.exports = options => {
}

const res = yield request(opt);

if (res.statusCode === 404) {
yield next;
} else {
this.status = res.statusCode;

for (const name in res.headers) {
// http://stackoverflow.com/questions/35525715/http-get-parse-error-code-hpe-unexpected-content-length
if (suppressResponseHeaders.indexOf(name.toLowerCase()) >= 0) {
Expand All @@ -93,6 +95,8 @@ module.exports = options => {
return;
}

// marking which middleware serves the request
this.set('x-served-by', 'egg-webpack');
this.body = res.body;

if (options.yieldNext) {
Expand Down

0 comments on commit c926325

Please sign in to comment.