Shaddix / react-query-swagger

Generates react-query hooks based on Swagger API definitions
MIT License
122 stars 4 forks source link

Throw Error if response status is 201 #18

Closed proggarapsody closed 1 year ago

proggarapsody commented 1 year ago

I receive 201 success response, but the error still appears изображение

I think, probably, we can handle 201 status as success too изображение

Shaddix commented 1 year ago

This could (and should :)) be configured in the OpenAPI. Here's the documentation for Responses section: https://swagger.io/docs/specification/describing-responses/

As you could see, you could specify response codes and results there. It will be handled by react-query-swagger as well.

If you use ASP.Net Core I could send you some other links for configuring it there :)

proggarapsody commented 1 year ago

@Shaddix Yes i am. This would be grateful if you share .net config links with me

Shaddix commented 1 year ago

You could add [ProducesResponseType(201)] attribute to your Action

Or add it globally services.AddControllers((options) => options.Filters.Add(new ProducesResponseTypeAttribute(201)));

proggarapsody commented 1 year ago

@Shaddix Thanks i'll try it