danielgtaylor / restish

Restish is a CLI for interacting with REST-ish HTTP APIs with some nice features built-in
https://rest.sh/
MIT License
717 stars 69 forks source link

Accèssing response body and headers not possible at same time #214

Closed arivictor closed 11 months ago

arivictor commented 11 months ago

I need to make a call to an endpoint to receive a CSRF token which gets sent back in the body. From this request I also need to retrieve a header Set-Cookie. For the life of me I cannot get both values from the single request.

restish my-api get-thin

HTTP/1.1 200 OK
Content-Length: 39
Content-Type: text/plain
Set-Cookie: JSESSIONID_80=123abc; 

J5ST-7AQ7-XPED-NRJ0-LPJU-Q9HE-X1JW-5DF1

Running the command shows that both details are there, however there is no way to access both it seems. If I try and send the output to a file it only sends the body. If I try and filter to the header I lose the body. And I can only filter on one thing.

Using -o json and -v also yields nothing. What can I do?

arivictor commented 11 months ago

Ok, what I found that's not documented in CLI but is in the docs is I can filter like below to include everything, not just the body:

restish my-api get-thing -o json -f '@' > output.json

From there I can find my values.