Response from Swagger "Try it out" is not the same as the one from the generated curl [duplicate] Response from Swagger "Try it out" is not the same as the one from the generated curl [duplicate] curl curl

Response from Swagger "Try it out" is not the same as the one from the generated curl [duplicate]


I found the answer (thanks @Helen for your tip !)

I checked the curl send by swagger in my browser developer tools and the cookie param was not there. I thought it would be handled like the others but it must be declared differently.

After checking the documentation I found that cookies param must be declared "in : cookie" instead of "in : header" (link). (which works, but there is a warning by the swagger editor which don't recognize it as a valid option)

Moreover this cookie being used for authentication purpose I used the dedicated securityScheme (link)

Here is the valid openapi specification

openapi: '3.0.0'components:  securitySchemes:    PHP_session:      type: apiKey      in: cookie      name: PHPSESSIDpaths:  /add.php:    get:      tags:        - information      security:        - PHP_session: []      responses:        '200':          description: successful operation

edit : Well, I learned a lot and the specification is now valid but indeed it still doesn't work (the response being hard to interpret I had some false hope there ^^'). But I guess it will do until swagger-ui support cookies.

edit : as specified in the answer of the related question (link), it works (for real this time) in SwaggerHub