diff --git a/src/GraphQL.Client/GraphQLHttpRequest.cs b/src/GraphQL.Client/GraphQLHttpRequest.cs
index 9ff0c600..c9d4e01a 100644
--- a/src/GraphQL.Client/GraphQLHttpRequest.cs
+++ b/src/GraphQL.Client/GraphQLHttpRequest.cs
@@ -1,5 +1,4 @@
using System.Net.Http.Headers;
-using System.Runtime.Serialization;
using System.Text;
using GraphQL.Client.Abstractions;
@@ -21,13 +20,6 @@ public GraphQLHttpRequest(GraphQLRequest other)
{
}
- ///
- /// Allows to preprocess a before it is sent, i.e. add custom headers
- ///
- [IgnoreDataMember]
- [Obsolete("Inherit from GraphQLHttpRequest and override ToHttpRequestMessage() to customize the HttpRequestMessage. Will be removed in v4.0.0.")]
- public Action PreprocessHttpRequestMessage { get; set; } = message => { };
-
///
/// Creates a from this .
/// Used by to convert GraphQL requests when sending them as regular HTTP requests.
@@ -48,9 +40,6 @@ public virtual HttpRequestMessage ToHttpRequestMessage(GraphQLHttpClientOptions
if (options.DefaultUserAgentRequestHeader != null)
message.Headers.UserAgent.Add(options.DefaultUserAgentRequestHeader);
-#pragma warning disable CS0618 // Type or member is obsolete
- PreprocessHttpRequestMessage(message);
-#pragma warning restore CS0618 // Type or member is obsolete
return message;
}
}
diff --git a/tests/GraphQL.Integration.Tests/QueryAndMutationTests/Base.cs b/tests/GraphQL.Integration.Tests/QueryAndMutationTests/Base.cs
index bff54832..0b120ba4 100644
--- a/tests/GraphQL.Integration.Tests/QueryAndMutationTests/Base.cs
+++ b/tests/GraphQL.Integration.Tests/QueryAndMutationTests/Base.cs
@@ -163,28 +163,6 @@ query Human($id: String!){
Assert.Equal("Han Solo", queryResponse.Data.Human.Name);
}
- [Fact]
- public async void PreprocessHttpRequestMessageIsCalled()
- {
- var callbackTester = new CallbackMonitor();
- var graphQLRequest = new GraphQLHttpRequest($"{{ human(id: \"1\") {{ name }} }}")
- {
-#pragma warning disable CS0618 // Type or member is obsolete
- PreprocessHttpRequestMessage = callbackTester.Invoke
-#pragma warning restore CS0618 // Type or member is obsolete
- };
-
- var expectedHeaders = new HttpRequestMessage().Headers;
- expectedHeaders.UserAgent.Add(new ProductInfoHeaderValue("GraphQL.Client", typeof(GraphQLHttpClient).Assembly.GetName().Version.ToString()));
- expectedHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/graphql-response+json"));
- expectedHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
- expectedHeaders.AcceptCharset.Add(new StringWithQualityHeaderValue("utf-8"));
- var response = await StarWarsClient.SendQueryAsync(graphQLRequest, () => new { Human = new { Name = string.Empty } });
- callbackTester.Should().HaveBeenInvokedWithPayload().Which.Headers.Should().BeEquivalentTo(expectedHeaders);
- Assert.Null(response.Errors);
- Assert.Equal("Luke", response.Data.Human.Name);
- }
-
[Fact]
public async Task PostRequestCanBeCancelled()
{