Skip to content

Commit ec6a5d7

Browse files
author
Raul Hidalgo Caballero
committed
using MediaTypeHeaderValue
1 parent d365c54 commit ec6a5d7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/GraphQL.Client/GraphQLClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public async Task<GraphQLResponse> PostAsync(GraphQLRequest request) {
130130
if (request.Query == null) { throw new ArgumentNullException(nameof(request.Query)); }
131131

132132
var graphQLString = JsonConvert.SerializeObject(request, this.Options.JsonSerializerSettings);
133-
var httpContent = new StringContent(graphQLString, Encoding.UTF8, this.Options.MediaType);
133+
var httpContent = new StringContent(graphQLString, Encoding.UTF8, this.Options.MediaType.MediaType);
134134
var httpResponseMessage = await this.httpClient.PostAsync(this.EndPoint, httpContent).ConfigureAwait(false);
135135
return await this.ReadHttpResponseMessageAsync(httpResponseMessage).ConfigureAwait(false);
136136
}

src/GraphQL.Client/GraphQLClientOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class GraphQLClientOptions {
3333
/// <summary>
3434
/// The <see cref="MediaTypeHeaderValue"/> that will be send on POST
3535
/// </summary>
36-
public string MediaType { get; set; } = "application/json"; // This should be "application/graphql" also "application/x-www-form-urlencoded" is Accepted
36+
public MediaTypeHeaderValue MediaType { get; set; } = new MediaTypeHeaderValue("application/json"); // This should be "application/graphql" also "application/x-www-form-urlencoded" is Accepted
3737

3838
}
3939

0 commit comments

Comments
 (0)