Skip to content

Commit

Permalink
support set response for decorateProxyReqOpt
Browse files Browse the repository at this point in the history
- now it's possible to set cookie for response
  • Loading branch information
supolik committed Oct 2, 2019
1 parent 6007a04 commit 85af365
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions app/steps/decorateProxyReqOpts.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ function defaultDecorator(proxyReqOptBuilder /*, userReq */) {
}

function decorateProxyReqOpt(container) {
var resolverFn = container.options.proxyReqOptDecorator || defaultDecorator;
var resolverFn = container.options.proxyReqOptDecorator || defaultDecorator;

return Promise
.resolve(resolverFn(container.proxy.reqBuilder, container.user.req))
.then(function(processedReqOpts) {
delete processedReqOpts.params;
container.proxy.reqBuilder = processedReqOpts;
return Promise.resolve(container);
return Promise
.resolve(resolverFn(container.proxy.reqBuilder, container.user.req, container.user.res))
.then(function(data) {
delete data.proxyReq.params;
container.proxy.reqBuilder = data.proxyReq;
container.user.res = data.res;
return Promise.resolve(container);
});
}

Expand Down

0 comments on commit 85af365

Please sign in to comment.