Closed Bug 1812511 Opened 1 year ago Closed 1 year ago

[Fetch API] Implement `Headers.prototype.getSetCookie`

Categories

(Core :: DOM: Networking, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
112 Branch
Tracking Status
firefox112 --- fixed

People

(Reporter: abotella, Assigned: abotella)

References

(Blocks 1 open bug, )

Details

(Whiteboard: [necko-triaged])

Attachments

(1 file)

Spec PR: https://github.com/whatwg/fetch/pull/1346
Test PR: https://github.com/web-platform-tests/wpt/pull/31442

The proposed getSetCookie() method of the Headers class allows getting a list of the values of the Set-Cookie header in the header list. This was not possible before, since the get() method would combine the values by joining them with comma and whitespace, which is valid per the HTTP spec, but clashes with Set-Cookie syntax.

The spec change that introduces this method also changes the iteration behavior for Headers to have each Set-Cookie header show up in the iteration, rather than having them combined.

The fetch spec's Request and Response classes don't allow setting the Set-Cookie header, and fetch will remove that header from the returned Response. This change to the spec does not change this. It only makes it so a user-created Headers class can deal with Set-Cookie headers in an easier way, and enables compatibility with server-side runtimes which allow these headers.

This patch implements the getSetCookie() method of the fetch spec's
Headers interface, which allows getting a list of the values in the
Set-Cookie header that are present in the header list. This was not
possible before, since the get() method would combine the values by
joining them with comma and whitespace, which is valid per the HTTP
spec, but clashes with Set-Cookie syntax.

The spec change that introduces this method also changes the iteration
behavior for Headers to have each Set-Cookie header show up in the
iteration, rather than having them combined, and this patch also
modifies InternalHeaders::MaybeSortList to implement that change.

Assignee: nobody → abotella
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Blocks: fetch
Severity: -- → S3
Priority: -- → P2
Whiteboard: [necko-triaged]
Pushed by opettay@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2b8b468fa38a
Implement `Headers.prototype.getSetCookie`. r=webidl,smaug,sunil
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: