diff --git a/src/GraphQL.Client/GraphQLHttpClient.cs b/src/GraphQL.Client/GraphQLHttpClient.cs index 584bd65a..af63a5ec 100644 --- a/src/GraphQL.Client/GraphQLHttpClient.cs +++ b/src/GraphQL.Client/GraphQLHttpClient.cs @@ -152,9 +152,9 @@ private async Task> SendAPQHttpRequestAsync(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! diff --git a/src/GraphQL.Client/GraphQLHttpClientOptions.cs b/src/GraphQL.Client/GraphQLHttpClientOptions.cs index 2544847c..31d55960 100644 --- a/src/GraphQL.Client/GraphQLHttpClientOptions.cs +++ b/src/GraphQL.Client/GraphQLHttpClientOptions.cs @@ -114,6 +114,6 @@ public static bool DefaultIsValidResponseToDeserialize(HttpResponseMessage r) public Func 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; }; }