Giter VIP home page Giter VIP logo

Comments (8)

apottere avatar apottere commented on June 30, 2024 1

It's possible graphql-java-servlet doesn't handle multipart correctly - I'll look into it.

from graphql-java-servlet.

apottere avatar apottere commented on June 30, 2024 1

Oh, I changed it because I think it's more appropriate too - I just thought it might still work.

from graphql-java-servlet.

apottere avatar apottere commented on June 30, 2024

I wasn't aware that request.getPart() only actually works in servlet 3.0 environments when multipart is explicitly turned on... I rewrote it using commons-fileupload and reworked the tests to actually test it with a content body instead of mocking out Part.

from graphql-java-servlet.

apottere avatar apottere commented on June 30, 2024

This is fixed in 2.1.0.

from graphql-java-servlet.

Vi-dot avatar Vi-dot commented on June 30, 2024

Thanks for your update.
But now I get a 400 Bad request :

Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> POST /graphql HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.47.0
> Accept: */*
> Content-Length: 187
> Expect: 100-continue
> content-type: multipart/graphql; boundary=------------------------966f88642585a397
> 
< HTTP/1.1 100 Continue
< HTTP/1.1 400 Bad Request
< Date: Thu, 06 Apr 2017 08:10:26 GMT
< Content-Length: 0
< Server: Jetty(9.4.3.v20170317)
* HTTP error before end of send, stop sending
< 
* Closing connection 0

It may be because I use Jetty ?

from graphql-java-servlet.

Vi-dot avatar Vi-dot commented on June 30, 2024

In fact you changed MIME type to multiplart/form-data, and you're right !
"graphql" as part key doesn't work with curl.
But it works fine with "query" key like this :

curl -v --request POST \
--url http://localhost:8080/graphql \
--header 'Content-Type: multipart/form-data' \
--form 'query=query {test { test } }'

Thx, it's solved for me

from graphql-java-servlet.

apottere avatar apottere commented on June 30, 2024

@Vi-dot Are you sure it doesn't work with multipart/graphql? I was under the impression it just checked the first part. Either way, when you send a "graphql" part, it has to be a JSON object since it can contain the query, variables, and operationName. It should look the same as the POST body.

from graphql-java-servlet.

Vi-dot avatar Vi-dot commented on June 30, 2024

@apottere
Yes with curl & multipart/graphql as main Content-Type, it doesn't work.
Then why you also changed MIME type in groovy test file there ?

I think multipart/form-data is more appropriate for main Content-Type. About Content-Type of each part, it could be different.

from graphql-java-servlet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.