|
1 | | -import cookie from 'cookie'; |
2 | 1 | import { identity } from 'ramda'; |
3 | 2 | import { isPlainObject } from 'ramda-adjunct'; |
4 | 3 | import { |
5 | 4 | test as testServerURLTemplate, |
6 | 5 | substitute as substituteServerURLTemplate, |
7 | 6 | } from 'openapi-server-url-templating'; |
| 7 | +import { |
| 8 | + serializeCookie, |
| 9 | + cookieValueLenientEncoder, |
| 10 | + cookieNameLenientValidator, |
| 11 | + cookieValueLenientValidator, |
| 12 | +} from '@swaggerexpert/cookie'; |
8 | 13 | import { ApiDOMStructuredError } from '@swagger-api/apidom-error'; |
9 | 14 | import { url } from '@swagger-api/apidom-reference/configuration/empty'; |
10 | 15 |
|
@@ -297,7 +302,15 @@ export function buildRequest(options) { |
297 | 302 | const cookieString = Object.keys(req.cookies).reduce((prev, cookieName) => { |
298 | 303 | const cookieValue = req.cookies[cookieName]; |
299 | 304 | const prefix = prev ? '&' : ''; |
300 | | - const stringified = cookie.serialize(cookieName, cookieValue); |
| 305 | + const stringified = serializeCookie([[cookieName, cookieValue]], { |
| 306 | + encoders: { |
| 307 | + value: cookieValueLenientEncoder, |
| 308 | + }, |
| 309 | + validators: { |
| 310 | + name: cookieNameLenientValidator, |
| 311 | + value: cookieValueLenientValidator, |
| 312 | + }, |
| 313 | + }); |
301 | 314 | return prev + prefix + stringified; |
302 | 315 | }, ''); |
303 | 316 | req.headers.Cookie = cookieString; |
|
0 commit comments