Is it possible to hijack the `writeJson` to add customized HTTP headers · Issue #3694 · 99designs/gqlgen · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, some of the transport allows adding fixed customized HTTP response headers.
But in our case, we would like to add customized headers based on GraphQL's response.
And as far as I know, it has no way to add dynamic headers(for example: operation/operation name)
unless we could hijack the writeJson method.
A possible solution to support this is to export a way to rewrite writeJson method, but I'm not sure
if this sounds good:
And then export a method like SetWriteJSONFn(fn WriteJSONFn) to allow overwriting the method. Can correct me if I'm wrong on this, and any suggestions would be helpful. Thank you!
I will be happy to submit a PR to support this if the direction is good.
The text was updated successfully, but these errors were encountered:
Currently, some of the transport allows adding fixed customized HTTP response headers.
But in our case, we would like to add customized headers based on GraphQL's response.
And as far as I know, it has no way to add dynamic headers(for example: operation/operation name)
unless we could hijack the
writeJson
method.A possible solution to support this is to export a way to rewrite
writeJson
method, but I'm not sureif this sounds good:
And then export a method like
SetWriteJSONFn(fn WriteJSONFn)
to allow overwriting the method. Can correct me if I'm wrong on this, and any suggestions would be helpful. Thank you!I will be happy to submit a PR to support this if the direction is good.
The text was updated successfully, but these errors were encountered: