swagger-api/swagger-ui

Curl Acts Different Then On Page Try it for header string with pipe in it

Open

#4.920 geöffnet am 3. Okt. 2018

Auf GitHub ansehen
 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (8.801 Forks)batch import
Hacktoberfestcat: try-it-outtype: bug

Repository-Metriken

Stars
 (25.447 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 20h 34m) (14 gemergte PRs in 30 T)

Beschreibung

Q&A (please complete the following information)

  • OS: Windows 10
  • Browser: chrome
  • Version: 68.0.3440.106
  • Method of installation: Swashbuckle
  • Swagger-UI version:
  • Swagger/OpenAPI version: Swagger 2.0

Content & configuration

I have configured swashbuckle to attach a json header to every request image

How can we help?

When I use the "Try it out" feature it works as expected and I see my browser sending the json out in the header: image

When I try to copy and paste the curl command to my Cygwin bash for git for windows I see that the pipe in the header was not properly escaped so the command fails: curl -X GET "http://localhost:26419/api/Widget/{id}" -H "accept: application/json" -H "CUSTOM_HEADER: [{"Type":"PIPE|test","Value":"value"},{"Type":"test2","Value":"value2"}]" image

Is it fair to think that the UI should escape the header value for anything bash may miss-interpret so that the experience between the "Try it out" and curl is the same?

Contributor Guide