Skip to content

Commit

Permalink
progress
Browse files Browse the repository at this point in the history
  • Loading branch information
sungam3r authored and rose-a committed Apr 22, 2024
1 parent 058d2e6 commit cf7c7c0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/GraphQL.Client/GraphQLHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ private async Task<GraphQLHttpResponse<TResponse>> SendAPQHttpRequestAsync<TResp

var response = await SendHttpRequestAsync<TResponse>(request, cancellationToken);

if (useAPQ && response.Errors?.Length > 0)
if (useAPQ)
{
if (response.Errors.Any(error => string.Equals(error.Message, "PersistedQueryNotFound", StringComparison.CurrentCultureIgnoreCase)))
if (response.Errors?.Any(error => string.Equals(error.Message, "PersistedQueryNotFound", StringComparison.CurrentCultureIgnoreCase)) == true)
{
// GraphQL server supports APQ!

Expand Down
2 changes: 1 addition & 1 deletion src/GraphQL.Client/GraphQLHttpClientOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ public static bool DefaultIsValidResponseToDeserialize(HttpResponseMessage r)
public Func<IGraphQLHttpResponse, bool> DisableAPQ { get; set; } = response =>
{
return ((int)response.StatusCode >= 400 && (int)response.StatusCode < 600) ||
response.Errors.Any(error => string.Equals(error.Message, "PersistedQueryNotSupported"));
response.Errors?.Any(error => string.Equals(error.Message, "PersistedQueryNotSupported", StringComparison.CurrentCultureIgnoreCase)) == true;
};
}

0 comments on commit cf7c7c0

Please sign in to comment.