graphql-client icon indicating copy to clipboard operation
graphql-client copied to clipboard

Error in a Mutation Execution of 6.0.1 Nuget Version

Open victorperez2911 opened this issue 2 years ago • 3 comments
trafficstars

Hi

  internal class WebApiAuthTokenService
  {
      
      private static GraphQLHttpClient GraphQLClientForCreateToken;

      private readonly string _webApiAddress;

      public WebApiAuthTokenService(string WebApiAddress) 
      {
          _webApiAddress = WebApiAddress;

          GraphQLClientForCreateToken = new GraphQLHttpClient(_webApiAddress, new NewtonsoftJsonSerializer());
      }


      public async Task<createTokenResponse> createToken(string login, string Password)
      {

          var heroRequest = new GraphQLRequest
          {
              Query = @"mutation createToken {
createToken(login: """ + login + @""", password: """ + Password + @""") 
{
                  token
              }
          }"
          };


          var ApiResponse = await GraphQLClientForCreateToken.SendMutationAsync<createTokenResponse>(heroRequest);

          return ApiResponse.Data;

      }

  }

Just by upgrading from version 6.0.0 to version 6.0.1 of the package, the above code starts reporting the exception with the text "The HTTP request failed with status code OK".

victorperez2911 avatar Oct 02 '23 18:10 victorperez2911

Could you please post your createTokenResponse class?

rose-a avatar Oct 02 '23 20:10 rose-a

@rose-a

createTokenResponse


internal class createTokenResponse
{
    public Createtoken createToken { get; set; }
}

internal class Createtoken
{
    public string token { get; set; }
}

victorperez2911 avatar Oct 03 '23 13:10 victorperez2911