Q&A (please complete the following information)
- OS: [e.g. macOS] macOS
- Environment: [e.g. Chrome 59, Node.js v10.0.0] Node v22.22.0
- Method of installation: [e.g. npm, unpkg] pnpm
- Swagger-Client version: [e.g. 3.8.0] 3.35.5
- Swagger/OpenAPI version: [e.g. Swagger 2.0, OpenAPI 3.0] OAS3
Content & configuration
Swagger/OpenAPI definition:
Swagger-Client usage:
import SwaggerClient from "swagger-client";
const operationId = "cookieTest";
const req = SwaggerClient.buildRequest({
spec: {
openapi: "3.1.0",
paths: {
"/": {
get: {
operationId,
parameters: [
{
name: "c1",
in: "cookie",
},
{
name: "c2",
in: "cookie",
},
],
},
},
},
},
operationId,
parameters: {
c1: "v1",
c2: "v2",
},
});
console.log(req.headers.Cookie);
if (req.headers.Cookie === "c2=v2") {
console.log("Seems like should be both cookies");
}
Describe the bug you're encountering
To reproduce...
Steps to reproduce the behavior:
- Set more than one cookie parameter
- Observe that only last cookie is set
Expected behavior
Expect when there are multiple cookies set, they will all be set. However, only last is set.
Additional context or thoughts
In
|
req.headers.Cookie = serializeCookie({ [cookieName]: cookieValue }); |
Cookie is always overwritten in both cases. OAS2 was not examined
req.headers.Cookie = serializeCookie({ [cookieName]: cookieValue });
Q&A (please complete the following information)
Content & configuration
Swagger/OpenAPI definition:
n/aSwagger-Client usage:
Describe the bug you're encountering
To reproduce...
Steps to reproduce the behavior:
Expected behavior
Expect when there are multiple cookies set, they will all be set. However, only last is set.
Additional context or thoughts
In
swagger-js/src/execute/oas3/parameter-builders.js
Line 118 in 7baca90