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

gateway pass header to each grapql service #270

Closed
SirReiva opened this issue Jul 28, 2021 · 5 comments
Closed

gateway pass header to each grapql service #270

SirReiva opened this issue Jul 28, 2021 · 5 comments

Comments

@SirReiva
Copy link

I`m testing gateway example and I don´t know how pass header recived by gateway to each service.

There are some documentation about that?

@SirReiva SirReiva changed the title gateway pass header to grapql service gateway pass header to each grapql service Jul 28, 2021
@jensneuse
Copy link
Member

The config you generate should look similar to this:

https://github.com/jensneuse/graphql-go-tools/blob/e69d4234c60ecb812ef0ac4d608a49621843aa23/pkg/engine/datasource/graphql_datasource/graphql_datasource_test.go#L217

@jensneuse
Copy link
Member

Please reopen in case you have additional questions.

@fouad1998
Copy link

fouad1998 commented Dec 20, 2021

Hi, I have took a look on different issue posted here in Github #115 #128 #270 about passing request headers to new request made by the engine (Client - Gateway -> Gateway - Service) but I couldn't find out how, I have tried for example the following

	if err = g.engine.Execute(r.Context(), &gqlRequest, &resultWriter, graphql.WithAdditionalHttpHeaders(r.Header)); err != nil {
		g.log.Error("engine.Execute", log.Error(err))
		w.WriteHeader(http.StatusInternalServerError)
		return
	}

but each time I fail the other service doesn't have access to the request headers. Can you please send us an example of code shows how to pass those headers or blog or even adding above of your example

thanks in advance

@cauchy2384
Copy link

Stuck with the same issue. Can't understand how to pass headers using WithAdditionalHttpHeaders.
Any good example?

thanks

@IsabelFreitas-catapult
Copy link

IsabelFreitas-catapult commented May 21, 2024

How do you this with subscriptions? Considering that custom headers in a ws connection usually comes in the form of an initPayload?

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

No branches or pull requests

5 participants