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

Server responds with 415 on application/graphql #6

Open
jeromecovington opened this issue Jan 7, 2016 · 1 comment
Open

Server responds with 415 on application/graphql #6

jeromecovington opened this issue Jan 7, 2016 · 1 comment

Comments

@jeromecovington
Copy link

I am working on a graphql + relay app served on top of hapi and have ported your code to my application.

Here you can see me sending POST requests to the graphql endpoint.

~> curl -X POST --header "Content-Type:application/json" -d '{"query":"{content(id:\"13381672\"){title,id}}"}' http://127.0.0.1:8000/graphql
{"data":{"content":{"title":"Example Title","id":"13381672"}}}
~> curl -X POST --header "Content-Type:application/graphql" -d '{"query":"{content(id:\"13381672\"){title,id}}"}' http://127.0.0.1:8000/graphql
{"statusCode":415,"error":"Unsupported Media Type"}

I have set up an options mime configuration as per the below, passing options into the server instantiation, but I am still seeing the "Unsupported Media Type" error.

options.mime = {
  override: {
    'application/graphql': {
      charset: 'UTF-8',
      compressible: true,
      type: 'application/graphql'
    }
  }
};

I don't see any mime configuration here. Is that an oversight, or am I missing something else?

@zoe-1
Copy link

zoe-1 commented Dec 27, 2017

Just came across this post with a google search.

The below works for me:
curl -X POST -H "Content-Type: application/json" -d '{"query":"{person(firstname:\"billy\"){lastname}}"}' http://127.0.0.1:8000/graphql

Checkout blow file for an example:
https://github.com/zoe-1/graphi/blob/master/example.js

Checkout Graphi

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

2 participants