Major Changes
-
#12644
fe2f005
Thanks @jerelmiller! - Replace theresult
property onServerError
withbodyText
.bodyText
is set to the raw string body.HttpLink
andBatchHttpLink
no longer try and parse the response body as JSON when aServerError
is thrown. -
#12644
fe2f005
Thanks @jerelmiller! - More strictly adhere to the GraphQL over HTTP spec. This change adds support for theapplication/graphql-response+json
media type and modifies the behavior of theapplication/json
media type.- The client will parse the response as a well-formed GraphQL response when the server encodes
content-type
usingapplication/graphql-response+json
with a non-200 status code. - The client will now throw a
ServerError
when the server encodescontent-type
usingapplication/json
and returns a non-200 status code. - The client will now throw a
ServerError
when the server encodes using any othercontent-type
and returns a non-200 status code.
NOTE: If you use a testing utility to mock requests in your test, you may experience different behavior than production if your testing utility responds as
application/json
but your production server responds asapplication/graphql-response+json
. If acontent-type
header is not set, the client interprets the response asapplication/json
. - The client will parse the response as a well-formed GraphQL response when the server encodes
-
#12644
fe2f005
Thanks @jerelmiller! - Change the defaultAccept
header toapplication/graphql-response+json,application/json;q=0.9
. -
#12644
fe2f005
Thanks @jerelmiller! -HttpLink
andBatchHttpLink
no longer emit anext
notification with the JSON-parsed response body when a well-formed GraphQL response is returned and aServerError
is thrown.