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

Use operationName from query if missing from POST #374

Merged

Conversation

willnewrelic
Copy link
Contributor

@willnewrelic willnewrelic commented Jan 28, 2020

Hi!

Here at New Relic we're working on creating instrumentation for this repo! The Tracer interface is working great!

I've noticed that when the "operationName" POST parameter is missing, the TraceQuery hook is never given an operationName even if there's an operation name in the query. This is unfortunate because having an operation name is very useful, and the "operationName" POST parameter is optional (https://graphql.org/learn/serving-over-http/#post-request).

Thanks for your consideration!

// Subscriptions are not valid in Exec. Use schema.Subscribe() instead.
if op.Type == query.Subscription {
return &Response{Errors: []*errors.QueryError{&errors.QueryError{ Message: "graphql-ws protocol header is missing" }}}
return &Response{Errors: []*errors.QueryError{&errors.QueryError{Message: "graphql-ws protocol header is missing"}}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My text editor likes gofmt. It can't help itself!

@pavelnikolov pavelnikolov merged commit 8334863 into graph-gophers:master Feb 7, 2020
@pavelnikolov
Copy link
Member

Thank you for your contribution. In future try not to combine logical changes with formatting changes, please.

@willnewrelic willnewrelic deleted the operationName-from-query branch February 7, 2020 01:12
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 this pull request may close these issues.

2 participants