Repository navigation
Conversation
Each cookie parameter used to overwrite req.headers.Cookie, so only the last one was sent. Append to the existing header instead. Closes swagger-api#4155
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The OAS3
cookieparameter builder assignedreq.headers.Cookiedirectly for every cookie parameter, so each one overwrote the one before. An operation with two or more cookie parameters only sent the last cookie.This change adds a small
appendCookiehelper insrc/execute/oas3/parameter-builders.jsthat joins the new cookie onto any existingCookieheader with;, the same wayexecute/index.jsalready mergesreq.cookies(for example an apiKey in a cookie) into the header. Both branches of the builder use it: thecontentbranch and thestyle/explodebranch.Motivation and Context
Fixes #4155. Thanks @mikhuang for the report and for pointing at the exact line.
How Has This Been Tested?
Added a test in
test/oas3/execute/style-explode/cookie.jsthat builds a request with three cookie parameters (a primitive, an exploded array and acontent-serialized object) and expects all three in oneCookieheader. Without the fix it fails (onlyc3=...is present); with the fix it passes.Ran
jestontest/oas3/executeandtest/execute(all passing), pluseslintandprettier --checkon the changed files.Screenshots (if appropriate):
Types of changes
package.json)Checklist:
Replaces #4291, which got closed when my fork was accidentally detached.