Comments (8)
It's possible graphql-java-servlet doesn't handle multipart correctly - I'll look into it.
from graphql-java-servlet.
Oh, I changed it because I think it's more appropriate too - I just thought it might still work.
from graphql-java-servlet.
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.
This is fixed in 2.1.0
.
from graphql-java-servlet.
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.
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.
@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.
@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)
- Dependency Dashboard
- GraphQLServletListener.onRequest() can't be guaranteed run before DataFetcher.get() HOT 7
- GraphQLPostInvocationInputParser may distort query string read from HttpServletRequest HOT 1
- A multipart graphql request is sensitive to the default charset of the jvm
- Support new GraphQLContext
- Uncaught exception thrown by HttpRequestInvokerImpl.invoke() causes main thread to "hang"
- Throwable is never a GraphQLError HOT 1
- utf-8 by default HOT 1
- Cannot error handle on creating `GraphqlInvocationInput` HOT 2
- graphql.kickstart.execution.OperationNameExtractor#parseForOperationName does not use PersistedQueryCache
- Allow unparseable query to be logged as a warning instead of an error or allow exception to be handled by server developer HOT 1
- Unable to handle exceptions raised by validation on parsing prior to GraphQL execution
- GraphQLServletListener.RequestCallback.onError not being called even though an exception throws HOT 2
- Support of graphql-transport-ws GraphQL subscription protocol HOT 11
- 48 vulnerabilities from jackson-databind HOT 1
- Servlet fails to recognize application/graphql when charset is specified HOT 1
- support for newer servlet specs HOT 4
- consider making servlet api's provided by server
- Unable to suppress InvocationInputParseException
- New ThreadPool are constantly being created on every http request HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphql-java-servlet.