Ask a Question

Interactive API Docs 'Try it out!' Headers

SOLVED
ngolubchuk
Occasional Contributor

Interactive API Docs 'Try it out!' Headers

Hi,

 

I tried to add 'Cookie' header to my request, but there isn't this header in request that comes to web app.

 

Here is my header spec:

      parameters:
        - name: "Cookie"
          in: header
          type: string
          default: "someCookies"

I also tried to add header through securityDefinitions.

I define my security definitions:

securityDefinitions:
  cookie:
    name: Cookie
    type: apiKey
    in: header

And add

      security: 
        - cookie: []

to my request operation.

But I can't see anything related to security at Interactive API Docs page. And header isn't added.

Are there any restrictions on what headers I can add to my requests when I use 'Try it out!' operation? Or am I doing something wrong?

Thanks in advance for your assistance.

 

Nikita.

 

 

 

 

 

5 REPLIES 5
ponelat
Staff

Hi again,

 

So you've hit a transport bug, we use cookies to authenticate SwaggerHub requests and they seem to be clashing with the Try It Out requests.

 

We're working on a solution and apologize for any inconvenience.

We'll post back here, as soon as we know more.

 

 

Hi Nikita,

 

So we've added a preliminary fix.

If you add a Cookie header parameter, and send it via the Interactive Api Doc's Try it our form, it will be proxied to your target server.

However, there is a caveat. We do the above step manually ( or something like that ), and Interactive Api Docs will not hold a cookie that gets sent /back/ from the target server.

 

We will release this and the 502 Gateway issue this week.

 

As part of our new release, we've updated the Interactive docs to include an *Authoriazation* button, which might help with your Cookie header... looking forward to see if that gives you the edge you need!

 

Happy Wednesday 🙂

Josh

 

ngolubchuk
Occasional Contributor

Hi again

I am very grateful that you're working on my issues.

Do I understand correct that I can add a cookie header to a request , and it will exists in the request, which comes directly into the web application, but I can not get cookie header in the response?

I'm just trying to add a Cookie header to my request through parameters, but I still can't see it in the request that comes to web app.

Here is my spec:

parameters:
        - name: Cookie
          in: header
          type: string
          default: "Some Cookie"

Hey...

 

So that should work... but we haven't released to production yet. We'll most likely release before the end of the week, and we can update this thread as soon as we do.

 

Josh

ngolubchuk
Occasional Contributor

Oh, I got it now.

At first I misunderstood the part about the release, I guess.

Thanks for quick reply.

 

Nikita

cancel
Showing results for 
Search instead for 
Did you mean: