router icon indicating copy to clipboard operation
router copied to clipboard

Access to `request` information from within a given `map_response` function in Rhai

Open lleadbet opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe.

There are cases where you may need to post-process specific responses from a subgraph, but need access to the original request's headers to do so, or information in the body to the subgraph.

Currently, there's no way to track a given request for a subgraph across the lifecycle as there are cases where subgraph requests could be done in parallel (e.g. using defer), even to the same subgraph. Given the lack of information across request/responses, it's impossible to do said post-processing.

Describe the solution you'd like

The response argument also contains a request sub-object (e.g. respnose.request.headers) that provides information about the original subgraph request.

Describe alternatives you've considered

Tracking this outside of the subgraph_service as global variables, but due to the limitations/edge cases noted, is not possible.

lleadbet avatar Jan 15 '24 17:01 lleadbet