Skip to content

Exception for empty response body #378

Open
@VikingRedleg

Description

@VikingRedleg

Hello,

I am trying to build a client for a very basic GraphQL request. This works for most of the response types, but the server sends 204 and 504 responses for specific scenarios, along with an empty response body. When this happens I get a NullReferenceException with the following stacktrace:

   at GraphQL.Client.Http.GraphQLHttpResponse`1..ctor(GraphQLResponse`1 response, HttpResponseHeaders responseHeaders, HttpStatusCode statusCode)
   at GraphQL.Client.Http.GraphQLResponseExtensions.ToGraphQLHttpResponse[T](GraphQLResponse`1 response, HttpResponseHeaders responseHeaders, HttpStatusCode statusCode)
   at GraphQL.Client.Http.GraphQLHttpClient.<SendHttpRequestAsync>d__28`1.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at GraphQL.Client.Http.GraphQLHttpClient.<SendQueryAsync>d__23`1.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at Application.Providers.Services.GqlApi.<GetGqlResponseAsync>d__18.MoveNext() in D:\tfs\codebase\..\GqlApi.cs:line 97

The normal response is some JSON object. Is there any way to just get back the status and null for the object data?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions