Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access to stitched http response headers (e.g. Set-Cookie) #679

Closed
tunurgitr opened this issue Apr 1, 2019 · 6 comments · Fixed by #733
Closed

Access to stitched http response headers (e.g. Set-Cookie) #679

tunurgitr opened this issue Apr 1, 2019 · 6 comments · Fixed by #733
Assignees
Milestone

Comments

@tunurgitr
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Some stitched endpoints set response cookies via the Set-Cookie header. I need to "proxy" those headers back to the original http request so the client can get them set. In some cases I may need to modify those values (e.g. modify a domain, if set).

Describe the solution you'd like
A clear extension point for intercepting stitched-schema-responses with access to the resolver context.

Describe alternatives you've considered
Well, not using cookies. That works fine sometimes, depending on how much control we have over the endpoint we're stitching. But I could envision wanting to interact with other reasons to access headers (logging, metrics, etc).

@michaelstaib
Copy link
Member

Sorry for letting you wait ... I will look into this tomorrow.

@michaelstaib
Copy link
Member

The IQueryResult will also have a property ContextData like types, contexts etc. This is basically a IDictionary<string, object> and allows to store custom non-serializable information. Everything that is stored in there will not get serialized and delivered to the consumer.

In schema stitching this property bag can basically used to store anything from a remote schema. We will also add a client handler now that can be injected.

So basically by injecting a client handler as a service you can now transfer any kind of data into this dictionary. The stitching middleware will copy the context data in the scoped resolver context data so that one can access this one in the stitching layer.

@michaelstaib
Copy link
Member

#754

@michaelstaib
Copy link
Member

public interface IHttpQueryRequestInterceptor
{
        Task OnReceivedResultAsync(
            IHttpQueryRequest request,
            HttpResponseMessage response,
            IQueryResult result);
}

@michaelstaib
Copy link
Member

this one is now done and included in preview.35.

@Sangeetha-Murugesan
Copy link

Sangeetha-Murugesan commented Mar 2, 2022

Hi @michaelstaib , we are trying to implement the same as mentioned above in our project to access the remote schema response headers in Gateway. But couldnt use "IHttpQueryRequestInterceptor" interface. what would be the HC namespace to access this interface ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants