ExpressGateway / express-gateway

A microservices API Gateway built on top of Express.js
https://www.express-gateway.io
Apache License 2.0
2.97k stars 344 forks source link

Feature request: Request Transformer add directly to req object #996

Open code-angels opened 4 years ago

code-angels commented 4 years ago

This feature request is to add a possibility to add objects directly to the request object that is sent to the service endpoint.

In my use case I'm either forced to add an authenticated 'user' object (which is added by verifying a jwt and setting this user object on the egContext through middleware) to either the header or body (using the request transformer).

It doesn't make too much sense to add the user object to the header, neither does it make sense to add it to the body in case of a GET request.
For now I can add it as a body key; however it would be much more useful to have the ability to add objects to the req object directly where it doesn't pollute either http header or body.