swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

Arbitrary number of key values in the POST body

Open ccsalway opened this issue 1 year ago • 0 comments

Content & configuration

Im using Swashbuckle.ASPNetCore 6.4.0 and have an API Controller listening for a POST request

[HttpPost("test")]
[Consumes(MediaTypeNames.Application.FormUrlEncoded)]
public IActionResult Test([FromBody] string content)

Which shows up in SwaggerUI and I have the option to add content for the body which I add key=1&val=1, but the curl generated looks as follows... it needs to support an arbitrary amount of random key value pairs.

curl -X 'POST'
'http://localhost:8001/config/test'
-H 'accept: /'
-H 'Content-Type: application/x-www-form-urlencoded'
-d '0=k&1=e&2=y&3=1&4=%3D&5=v&6=a&7=l&8=1'

How can I make it not split the string??

Screenshots

Screenshot 2024-07-25 at 23 04 27

How can we help?

ccsalway avatar Jul 25 '24 22:07 ccsalway