File tree Expand file tree Collapse file tree 2 files changed +0
-33
lines changed
tests/GraphQL.Integration.Tests/QueryAndMutationTests Expand file tree Collapse file tree 2 files changed +0
-33
lines changed Original file line number Diff line number Diff line change 11using System . Net . Http . Headers ;
2- using System . Runtime . Serialization ;
32using System . Text ;
43using GraphQL . Client . Abstractions ;
54
@@ -21,13 +20,6 @@ public GraphQLHttpRequest(GraphQLRequest other)
2120 {
2221 }
2322
24- /// <summary>
25- /// Allows to preprocess a <see cref="HttpRequestMessage"/> before it is sent, i.e. add custom headers
26- /// </summary>
27- [ IgnoreDataMember ]
28- [ Obsolete ( "Inherit from GraphQLHttpRequest and override ToHttpRequestMessage() to customize the HttpRequestMessage. Will be removed in v4.0.0." ) ]
29- public Action < HttpRequestMessage > PreprocessHttpRequestMessage { get ; set ; } = message => { } ;
30-
3123 /// <summary>
3224 /// Creates a <see cref="HttpRequestMessage"/> from this <see cref="GraphQLHttpRequest"/>.
3325 /// Used by <see cref="GraphQLHttpClient"/> to convert GraphQL requests when sending them as regular HTTP requests.
@@ -48,9 +40,6 @@ public virtual HttpRequestMessage ToHttpRequestMessage(GraphQLHttpClientOptions
4840 if ( options . DefaultUserAgentRequestHeader != null )
4941 message . Headers . UserAgent . Add ( options . DefaultUserAgentRequestHeader ) ;
5042
51- #pragma warning disable CS0618 // Type or member is obsolete
52- PreprocessHttpRequestMessage ( message ) ;
53- #pragma warning restore CS0618 // Type or member is obsolete
5443 return message ;
5544 }
5645}
Original file line number Diff line number Diff line change @@ -163,28 +163,6 @@ query Human($id: String!){
163163 Assert . Equal ( "Han Solo" , queryResponse . Data . Human . Name ) ;
164164 }
165165
166- [ Fact ]
167- public async void PreprocessHttpRequestMessageIsCalled ( )
168- {
169- var callbackTester = new CallbackMonitor < HttpRequestMessage > ( ) ;
170- var graphQLRequest = new GraphQLHttpRequest ( $ "{{ human(id: \" 1\" ) {{ name }} }}")
171- {
172- #pragma warning disable CS0618 // Type or member is obsolete
173- PreprocessHttpRequestMessage = callbackTester . Invoke
174- #pragma warning restore CS0618 // Type or member is obsolete
175- } ;
176-
177- var expectedHeaders = new HttpRequestMessage ( ) . Headers ;
178- expectedHeaders . UserAgent . Add ( new ProductInfoHeaderValue ( "GraphQL.Client" , typeof ( GraphQLHttpClient ) . Assembly . GetName ( ) . Version . ToString ( ) ) ) ;
179- expectedHeaders . Accept . Add ( new MediaTypeWithQualityHeaderValue ( "application/graphql-response+json" ) ) ;
180- expectedHeaders . Accept . Add ( new MediaTypeWithQualityHeaderValue ( "application/json" ) ) ;
181- expectedHeaders . AcceptCharset . Add ( new StringWithQualityHeaderValue ( "utf-8" ) ) ;
182- var response = await StarWarsClient . SendQueryAsync ( graphQLRequest , ( ) => new { Human = new { Name = string . Empty } } ) ;
183- callbackTester . Should ( ) . HaveBeenInvokedWithPayload ( ) . Which . Headers . Should ( ) . BeEquivalentTo ( expectedHeaders ) ;
184- Assert . Null ( response . Errors ) ;
185- Assert . Equal ( "Luke" , response . Data . Human . Name ) ;
186- }
187-
188166 [ Fact ]
189167 public async Task PostRequestCanBeCancelled ( )
190168 {
You can’t perform that action at this time.
0 commit comments