We are using the GraphQL client NuGet package (https://github.com/graphql-dotnet/graphql-client) and
in our .NET 4.7.2 solution, we are currently, calling an GraphQL API like this:
protected SomeService(ILogger logger, IGraphQLClient client)
{
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
_client = client ?? throw new ArgumentNullException(nameof(client));
}
public async Task<T> ExecuteMutation<T>(GraphQLRequest request)
{
try
{
var response = await _client.SendMutationAsync<T>(request);
return response.Data;
}
catch (GraphQLHttpRequestException ghre)
{
_logger.Error(ghre.Message, ghre);
}
catch (Exception ex)
{
_logger.Error(ex.Message, ex);
throw;
}
}
However, the API we are calling is not always returning an object. Sometimes, we just get an HTTP 200 OK
response code back.
It seems that there is no method overload on the GraphQLClient
, that can be used when there is only an HTTP response code.
How do we handle that scenario?