Forum Discussion

S_M's avatar
S_M
Occasional Visitor
3 years ago

Swagger POST request with parameter content type application/x-www-form-urlencoded fails

I have a Web API in .NET Framework 4.8 C#, and have implemented Swagger for documentation.

 

The web api accepts "application/json" as well as "application/x-www-form-urlencoded". Both type of requests works fine in Postman.

With Swagger UI post request works with "application/json", but when I switch to parameter content type "application/x-www-form-urlencoded", the request fails with response as bad request.

 

Also when I want to post with "application/x-www-form-urlencoded" the request doesn't show form input boxes, and JSON input box is shown.

 

Any solution to get the API working on swagger with "application/x-www-form-urlencoded" ?

 

Thanks

 

No RepliesBe the first to reply