RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.69k stars 1.24k forks source link

Typescript axios problem #4134

Open Omega-me opened 2 years ago

Omega-me commented 2 years ago

There is a problem with typescript axios generated file, the problem is when you parse the response and return dhe data, JSON.parse(response.data) it cause error, normally the request results to a success response but if I want to store dhe data somewhere its not possible because JSON.parse(response.data) wont give me the results but its an error about JSON not being able to parse a the response.data, it would be enough to just return response.data instead of JSON.parse(response data) since axios returns a js object

vipwan commented 1 year ago

same problem !

dmtx97 commented 1 year ago

Having this issue as well. Any workarounds to fix the generated code?

feelgood-interface commented 1 year ago

Here is a workaround: https://github.com/RicoSuter/NSwag/issues/3294