Kong / Kong/insomnia

[Feature Request] - Retrieve more than one cookie when testing

Open
#4,923 3 comments 0 reactions 0 assignees View on GitHub
N-investigation PA-cookies PA-testing S-unverified
Dominant language
TypeScript
Stars
40k
Forks
2.4k
Avg merge
2d 13h
Merged PRs (30d)
61

Description

### Discussed in https://github.com/Kong/insomnia/discussions/4922

Originally posted by **amb-lucas** June 30, 2022
### Context
I'm trying to test a request which expects multiple cookies in the response.

### Issue
I currently fetch the cookies via the response headers (response.headers['set-cookie']), but because the headers are parsed as an object, the headers['set-cookie'] is overwritten.
In other words, when a response comes back with two ['set-cookie'] headers, only the last cookie can be fetched via the request.headers object.

I tried to look for a workaround as to how to directly read the cookies from the testing script, but couldn't find anything :/

### Steps to reproduce
1. Make a request which has a response with multiple cookies being set
2. Try to access them via testing scripts (response.headers['set-cookie'] is the way I know how)
3. The first cookie set shouldn't be accessible/visible

Contributor guide

Open the contributing guide

Research direction

Start by tracing how testing scripts expose response.headers and how repeated set-cookie headers are parsed. Use the reproduction steps with a response that sets multiple cookies; done means testing scripts can access every set-cookie value rather than only the last one.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.