-
Notifications
You must be signed in to change notification settings - Fork 135
Description
I'm trying to use the GraphQL.Client library in a project that interacts with a 3rd party API. Currently, the API only accepts application/json
for the ACCEPT header. Is there an easy way to override the library's default value of application/graphql-response+json, application/json
(https://github.com/graphql-dotnet/graphql-client/blob/master/src/GraphQL.Client/GraphQLHttpRequest.cs#L45)? I tried the following code, but it did not work.
using var graphQLClient = new GraphQLHttpClient("https://3rdpartyservice.com/graphql", new NewtonsoftJsonSerializer());
graphQLClient.HttpClient.DefaultRequestHeaders.Accept.Clear();
graphQLClient.HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
I understand the library was updated to follow the spec for GraphQL over HTTP (#459), but that is still in the draft phase, and it appears the company that maintains the API hasn't implemented the spec's requirement. I've opened a ticket with the company to see if they can update their API to more closely conform to the draft spec, In the meantime, I wanted to see if there was an easy way to get my project working.