[ci] format

This commit is contained in:
matthewp 2022-09-28 20:57:35 +00:00 committed by fredkbot
parent d3091f89e9
commit 55a1b5bb58
23 changed files with 127 additions and 137 deletions

View file

@ -14,8 +14,8 @@ import type * as vite from 'vite';
import type { z } from 'zod';
import type { SerializedSSRManifest } from '../core/app/types';
import type { PageBuildData } from '../core/build/types';
import type { AstroCookies } from '../core/cookies';
import type { AstroConfigSchema } from '../core/config';
import type { AstroCookies } from '../core/cookies';
import type { ViteConfigWithSSR } from '../core/create-vite';
import type { AstroComponentFactory, Metadata } from '../runtime/server';
export type {
@ -120,7 +120,7 @@ export interface AstroGlobal extends AstroGlobalPartial {
/**
* Utility for getting and setting cookies values.
*/
cookies: AstroCookies,
cookies: AstroCookies;
url: URL;
/** Parameters passed to a dynamic page generated using [getStaticPaths](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
*

View file

@ -9,6 +9,7 @@ import type { LogOptions } from '../logger/core.js';
import type { RouteInfo, SSRManifest as Manifest } from './types';
import mime from 'mime';
import { getSetCookiesFromResponse } from '../cookies/index.js';
import { call as callEndpoint } from '../endpoint/index.js';
import { consoleLogDestination } from '../logger/console.js';
import { error } from '../logger/core.js';
@ -21,7 +22,6 @@ import {
} from '../render/ssr-element.js';
import { matchRoute } from '../routing/match.js';
export { deserializeManifest } from './common.js';
import { getSetCookiesFromResponse } from '../cookies/index.js';
export const pagesVirtualModuleId = '@astrojs-pages-virtual-entry';
export const resolvedPagesVirtualModuleId = '\0' + pagesVirtualModuleId;

View file

@ -2,13 +2,13 @@ import type { CookieSerializeOptions } from 'cookie';
import { parse, serialize } from 'cookie';
interface AstroCookieSetOptions {
domain?: string;
expires?: Date;
httpOnly?: boolean;
maxAge?: number;
path?: string;
sameSite?: boolean | 'lax' | 'none' | 'strict';
secure?: boolean;
domain?: string;
expires?: Date;
httpOnly?: boolean;
maxAge?: number;
path?: string;
sameSite?: boolean | 'lax' | 'none' | 'strict';
secure?: boolean;
}
interface AstroCookieDeleteOptions {
@ -16,17 +16,17 @@ interface AstroCookieDeleteOptions {
}
interface AstroCookieInterface {
value: string | undefined;
json(): Record<string, any>;
number(): number;
value: string | undefined;
json(): Record<string, any>;
number(): number;
boolean(): boolean;
}
interface AstroCookiesInterface {
get(key: string): AstroCookieInterface;
get(key: string): AstroCookieInterface;
has(key: string): boolean;
set(key: string, value: string | Record<string, any>, options?: AstroCookieSetOptions): void;
delete(key: string, options?: AstroCookieDeleteOptions): void;
set(key: string, value: string | Record<string, any>, options?: AstroCookieSetOptions): void;
delete(key: string, options?: AstroCookieDeleteOptions): void;
}
const DELETED_EXPIRATION = new Date(0);
@ -35,7 +35,7 @@ const DELETED_VALUE = 'deleted';
class AstroCookie implements AstroCookieInterface {
constructor(public value: string | undefined) {}
json() {
if(this.value === undefined) {
if (this.value === undefined) {
throw new Error(`Cannot convert undefined to an object.`);
}
return JSON.parse(this.value);
@ -44,8 +44,8 @@ class AstroCookie implements AstroCookieInterface {
return Number(this.value);
}
boolean() {
if(this.value === 'false') return false;
if(this.value === '0') return false;
if (this.value === 'false') return false;
if (this.value === '0') return false;
return Boolean(this.value);
}
}
@ -68,10 +68,10 @@ class AstroCookies implements AstroCookiesInterface {
*/
delete(key: string, options?: AstroCookieDeleteOptions): void {
const serializeOptions: CookieSerializeOptions = {
expires: DELETED_EXPIRATION
expires: DELETED_EXPIRATION,
};
if(options?.path) {
if (options?.path) {
serializeOptions.path = options.path;
}
@ -79,7 +79,7 @@ class AstroCookies implements AstroCookiesInterface {
this.#ensureOutgoingMap().set(key, [
DELETED_VALUE,
serialize(key, DELETED_VALUE, serializeOptions),
false
false,
]);
}
@ -92,9 +92,9 @@ class AstroCookies implements AstroCookiesInterface {
*/
get(key: string): AstroCookie {
// Check for outgoing Set-Cookie values first
if(this.#outgoing !== null && this.#outgoing.has(key)) {
let [serializedValue,, isSetValue] = this.#outgoing.get(key)!;
if(isSetValue) {
if (this.#outgoing !== null && this.#outgoing.has(key)) {
let [serializedValue, , isSetValue] = this.#outgoing.get(key)!;
if (isSetValue) {
return new AstroCookie(serializedValue);
} else {
return new AstroCookie(undefined);
@ -110,11 +110,11 @@ class AstroCookies implements AstroCookiesInterface {
* Astro.cookies.has(key) returns a boolean indicating whether this cookie is either
* part of the initial request or set via Astro.cookies.set(key)
* @param key The cookie to check for.
* @returns
* @returns
*/
has(key: string): boolean {
if(this.#outgoing !== null && this.#outgoing.has(key)) {
let [,,isSetValue] = this.#outgoing.get(key)!;
if (this.#outgoing !== null && this.#outgoing.has(key)) {
let [, , isSetValue] = this.#outgoing.get(key)!;
return isSetValue;
}
const values = this.#ensureParsed();
@ -132,13 +132,13 @@ class AstroCookies implements AstroCookiesInterface {
*/
set(key: string, value: string | Record<string, any>, options?: AstroCookieSetOptions): void {
let serializedValue: string;
if(typeof value === 'string') {
if (typeof value === 'string') {
serializedValue = value;
} else {
// Support stringifying JSON objects for convenience. First check that this is
// a plain object and if it is, stringify. If not, allow support for toString() overrides.
let toStringValue = value.toString();
if(toStringValue === Object.prototype.toString.call(value)) {
if (toStringValue === Object.prototype.toString.call(value)) {
serializedValue = JSON.stringify(value);
} else {
serializedValue = toStringValue;
@ -146,14 +146,14 @@ class AstroCookies implements AstroCookiesInterface {
}
const serializeOptions: CookieSerializeOptions = {};
if(options) {
if (options) {
Object.assign(serializeOptions, options);
}
this.#ensureOutgoingMap().set(key, [
serializedValue,
serialize(key, serializedValue, serializeOptions),
true
true,
]);
}
@ -161,27 +161,27 @@ class AstroCookies implements AstroCookiesInterface {
* Astro.cookies.header() returns an iterator for the cookies that have previously
* been set by either Astro.cookies.set() or Astro.cookies.delete().
* This method is primarily used by adapters to set the header on outgoing responses.
* @returns
* @returns
*/
*headers(): Generator<string, void, unknown> {
if(this.#outgoing == null) return;
for(const [,value] of this.#outgoing) {
if (this.#outgoing == null) return;
for (const [, value] of this.#outgoing) {
yield value[1];
}
}
#ensureParsed(): Record<string, string> {
if(!this.#requestValues) {
if (!this.#requestValues) {
this.#parse();
}
if(!this.#requestValues) {
if (!this.#requestValues) {
this.#requestValues = {};
}
return this.#requestValues;
}
#ensureOutgoingMap(): Map<string, [string, string, boolean]> {
if(!this.#outgoing) {
if (!this.#outgoing) {
this.#outgoing = new Map();
}
return this.#outgoing;
@ -189,7 +189,7 @@ class AstroCookies implements AstroCookiesInterface {
#parse() {
const raw = this.#request.headers.get('cookie');
if(!raw) {
if (!raw) {
return;
}
@ -197,6 +197,4 @@ class AstroCookies implements AstroCookiesInterface {
}
}
export {
AstroCookies
};
export { AstroCookies };

View file

@ -1,9 +1,2 @@
export {
AstroCookies
} from './cookies.js';
export {
attachToResponse,
getSetCookiesFromResponse
} from './response.js';
export { AstroCookies } from './cookies.js';
export { attachToResponse, getSetCookiesFromResponse } from './response.js';

View file

@ -8,19 +8,19 @@ export function attachToResponse(response: Response, cookies: AstroCookies) {
function getFromResponse(response: Response): AstroCookies | undefined {
let cookies = Reflect.get(response, astroCookiesSymbol);
if(cookies != null) {
if (cookies != null) {
return cookies as AstroCookies;
} else {
return undefined;
}
}
export function * getSetCookiesFromResponse(response: Response): Generator<string, void, unknown> {
export function* getSetCookiesFromResponse(response: Response): Generator<string, void, unknown> {
const cookies = getFromResponse(response);
if(!cookies) {
if (!cookies) {
return;
}
for(const headerValue of cookies.headers()) {
for (const headerValue of cookies.headers()) {
yield headerValue;
}
}

View file

@ -1,8 +1,8 @@
import type { APIContext, EndpointHandler, Params } from '../../@types/astro';
import type { RenderOptions } from '../render/core';
import { AstroCookies, attachToResponse } from '../cookies/index.js';
import { renderEndpoint } from '../../runtime/server/index.js';
import { AstroCookies, attachToResponse } from '../cookies/index.js';
import { getParamsAndProps, GetParamsAndPropsError } from '../render/core.js';
export type EndpointOptions = Pick<
@ -34,7 +34,7 @@ function createAPIContext(request: Request, params: Params): APIContext {
return {
cookies: new AstroCookies(request),
request,
params
params,
};
}

View file

@ -10,8 +10,8 @@ import type {
} from '../../@types/astro';
import type { LogOptions } from '../logger/core.js';
import { attachToResponse } from '../cookies/index.js';
import { Fragment, renderPage } from '../../runtime/server/index.js';
import { attachToResponse } from '../cookies/index.js';
import { getParams } from '../routing/params.js';
import { createResult } from './result.js';
import { callGetStaticPaths, findPathItemByKey, RouteCache } from './route-cache.js';
@ -169,7 +169,7 @@ export async function render(opts: RenderOptions): Promise<Response> {
// If there is an Astro.cookies instance, attach it to the response so that
// adapters can grab the Set-Cookie headers.
if(result.cookies) {
if (result.cookies) {
attachToResponse(response, result.cookies);
}

View file

@ -177,7 +177,7 @@ export function createResult(args: CreateResultArgs): SSRResult {
return Reflect.get(request, clientAddressSymbol);
},
get cookies() {
if(cookies) {
if (cookies) {
return cookies;
}
cookies = new AstroCookies(request);

View file

@ -5,8 +5,8 @@ import type { AstroSettings, ManifestData } from '../@types/astro';
import type { SSROptions } from '../core/render/dev/index';
import { Readable } from 'stream';
import { call as callEndpoint } from '../core/endpoint/dev/index.js';
import { getSetCookiesFromResponse } from '../core/cookies/index.js';
import { call as callEndpoint } from '../core/endpoint/dev/index.js';
import {
collectErrorMetadata,
ErrorWithMetadata,
@ -65,7 +65,7 @@ async function writeWebResponse(res: http.ServerResponse, webResponse: Response)
// Attach any set-cookie headers added via Astro.cookies.set()
const setCookieHeaders = Array.from(getSetCookiesFromResponse(webResponse));
if(setCookieHeaders.length) {
if (setCookieHeaders.length) {
res.setHeader('Set-Cookie', setCookieHeaders);
}
res.writeHead(status, _headers);

View file

@ -30,19 +30,19 @@ describe('Astro.cookies', () => {
it('is able to get cookies from the request', async () => {
const response = await fixture.fetch('/get-json', {
headers: {
cookie: `prefs=${encodeURIComponent(JSON.stringify({ mode: 'light' }))}`
}
cookie: `prefs=${encodeURIComponent(JSON.stringify({ mode: 'light' }))}`,
},
});
expect(response.status).to.equal(200);
const html = await response.text();
const $ = cheerio.load(html);
expect($('dd').text()).to.equal('light');
});
it('can set the cookie value', async () => {
const response = await fixture.fetch('/set-value', {
method: 'POST'
method: 'POST',
});
expect(response.status).to.equal(200);
expect(response.headers.has('set-cookie')).to.equal(true);
@ -61,35 +61,35 @@ describe('Astro.cookies', () => {
const response = await app.render(request);
return response;
}
it('is able to get cookies from the request', async () => {
const response = await fetchResponse('/get-json', {
headers: {
cookie: `prefs=${encodeURIComponent(JSON.stringify({ mode: 'light' }))}`
}
cookie: `prefs=${encodeURIComponent(JSON.stringify({ mode: 'light' }))}`,
},
});
expect(response.status).to.equal(200);
const html = await response.text();
const $ = cheerio.load(html);
expect($('dd').text()).to.equal('light');
});
it('can set the cookie value', async () => {
const response = await fetchResponse('/set-value', {
method: 'POST'
method: 'POST',
});
expect(response.status).to.equal(200);
let headers = Array.from(app.setCookieHeaders(response));
expect(headers).to.have.a.lengthOf(1);
expect(headers[0]).to.match(/Expires/);
});
it('Early returning a Response still includes set headers', async () => {
const response = await fetchResponse('/early-return', {
headers: {
cookie: `prefs=${encodeURIComponent(JSON.stringify({ mode: 'light' }))}`
}
cookie: `prefs=${encodeURIComponent(JSON.stringify({ mode: 'light' }))}`,
},
});
expect(response.status).to.equal(302);
let headers = Array.from(app.setCookieHeaders(response));
@ -99,13 +99,13 @@ describe('Astro.cookies', () => {
expect(data).to.be.an('object');
expect(data.mode).to.equal('dark');
});
it('API route can get and set cookies', async () => {
const response = await fetchResponse('/set-prefs', {
method: 'POST',
headers: {
cookie: `prefs=${encodeURIComponent(JSON.stringify({ mode: 'light' }))}`
}
cookie: `prefs=${encodeURIComponent(JSON.stringify({ mode: 'light' }))}`,
},
});
expect(response.status).to.equal(302);
let headers = Array.from(app.setCookieHeaders(response));
@ -115,5 +115,5 @@ describe('Astro.cookies', () => {
expect(data).to.be.an('object');
expect(data.mode).to.equal('dark');
});
})
});
});

View file

@ -9,8 +9,8 @@ describe('astro/src/core/cookies', () => {
it('creates a Set-Cookie header to delete it', () => {
let req = new Request('http://example.com/', {
headers: {
'cookie': 'foo=bar'
}
cookie: 'foo=bar',
},
});
let cookies = new AstroCookies(req);
expect(cookies.get('foo').value).to.equal('bar');
@ -23,8 +23,8 @@ describe('astro/src/core/cookies', () => {
it('calling cookies.get() after returns undefined', () => {
let req = new Request('http://example.com/', {
headers: {
'cookie': 'foo=bar'
}
cookie: 'foo=bar',
},
});
let cookies = new AstroCookies(req);
expect(cookies.get('foo').value).to.equal('bar');
@ -36,8 +36,8 @@ describe('astro/src/core/cookies', () => {
it('calling cookies.has() after returns false', () => {
let req = new Request('http://example.com/', {
headers: {
'cookie': 'foo=bar'
}
cookie: 'foo=bar',
},
});
let cookies = new AstroCookies(req);
expect(cookies.has('foo')).to.equal(true);
@ -50,7 +50,7 @@ describe('astro/src/core/cookies', () => {
let req = new Request('http://example.com/');
let cookies = new AstroCookies(req);
cookies.delete('foo', {
path: '/subpath/'
path: '/subpath/',
});
let headers = Array.from(cookies.headers());
expect(headers).to.have.a.lengthOf(1);

View file

@ -9,8 +9,8 @@ describe('astro/src/core/cookies', () => {
it('gets the cookie value', () => {
const req = new Request('http://example.com/', {
headers: {
'cookie': 'foo=bar'
}
cookie: 'foo=bar',
},
});
const cookies = new AstroCookies(req);
expect(cookies.get('foo').value).to.equal('bar');
@ -20,8 +20,8 @@ describe('astro/src/core/cookies', () => {
it('returns a JavaScript object', () => {
const req = new Request('http://example.com/', {
headers: {
'cookie': 'foo=%7B%22key%22%3A%22value%22%7D'
}
cookie: 'foo=%7B%22key%22%3A%22value%22%7D',
},
});
let cookies = new AstroCookies(req);
@ -42,8 +42,8 @@ describe('astro/src/core/cookies', () => {
it('Coerces into a number', () => {
const req = new Request('http://example.com/', {
headers: {
'cookie': 'foo=22'
}
cookie: 'foo=22',
},
});
let cookies = new AstroCookies(req);
@ -55,8 +55,8 @@ describe('astro/src/core/cookies', () => {
it('Coerces non-number into NaN', () => {
const req = new Request('http://example.com/', {
headers: {
'cookie': 'foo=bar'
}
cookie: 'foo=bar',
},
});
let cookies = new AstroCookies(req);
@ -70,8 +70,8 @@ describe('astro/src/core/cookies', () => {
it('Coerces true into `true`', () => {
const req = new Request('http://example.com/', {
headers: {
'cookie': 'foo=true'
}
cookie: 'foo=true',
},
});
let cookies = new AstroCookies(req);
@ -83,8 +83,8 @@ describe('astro/src/core/cookies', () => {
it('Coerces false into `false`', () => {
const req = new Request('http://example.com/', {
headers: {
'cookie': 'foo=false'
}
cookie: 'foo=false',
},
});
let cookies = new AstroCookies(req);
@ -96,8 +96,8 @@ describe('astro/src/core/cookies', () => {
it('Coerces 1 into `true`', () => {
const req = new Request('http://example.com/', {
headers: {
'cookie': 'foo=1'
}
cookie: 'foo=1',
},
});
let cookies = new AstroCookies(req);
@ -109,8 +109,8 @@ describe('astro/src/core/cookies', () => {
it('Coerces 0 into `false`', () => {
const req = new Request('http://example.com/', {
headers: {
'cookie': 'foo=0'
}
cookie: 'foo=0',
},
});
let cookies = new AstroCookies(req);
@ -122,8 +122,8 @@ describe('astro/src/core/cookies', () => {
it('Coerces truthy strings into `true`', () => {
const req = new Request('http://example.com/', {
headers: {
'cookie': 'foo=bar'
}
cookie: 'foo=bar',
},
});
let cookies = new AstroCookies(req);

View file

@ -9,8 +9,8 @@ describe('astro/src/core/cookies', () => {
it('returns true if the request has the cookie', () => {
let req = new Request('http://example.com/', {
headers: {
'cookie': 'foo=bar'
}
cookie: 'foo=bar',
},
});
let cookies = new AstroCookies(req);
expect(cookies.has('foo')).to.equal(true);

View file

@ -20,7 +20,7 @@ describe('astro/src/core/cookies', () => {
let cookies = new AstroCookies(req);
cookies.set('foo', 'bar', {
httpOnly: true,
path: '/subpath/'
path: '/subpath/',
});
let headers = Array.from(cookies.headers());
expect(headers).to.have.a.lengthOf(1);
@ -68,12 +68,12 @@ describe('astro/src/core/cookies', () => {
it('Overrides a value in the request', () => {
let req = new Request('http://example.com/', {
headers: {
'cookie': 'foo=bar'
}
cookie: 'foo=bar',
},
});
let cookies = new AstroCookies(req);
expect(cookies.get('foo').value).to.equal('bar');
// Set a new value
cookies.set('foo', 'baz');
expect(cookies.get('foo').value).to.equal('baz');

View file

@ -28,8 +28,8 @@ export function createExports(manifest: SSRManifest) {
);
let response = await app.render(request, routeData);
if(app.setCookieHeaders) {
for(const setCookieHeader of app.setCookieHeaders(response)) {
if (app.setCookieHeaders) {
for (const setCookieHeader of app.setCookieHeaders(response)) {
response.headers.append('Set-Cookie', setCookieHeader);
}
}

View file

@ -30,8 +30,8 @@ export function createExports(manifest: SSRManifest) {
);
let response = await app.render(request, routeData);
if(app.setCookieHeaders) {
for(const setCookieHeader of app.setCookieHeaders(response)) {
if (app.setCookieHeaders) {
for (const setCookieHeader of app.setCookieHeaders(response)) {
response.headers.append('Set-Cookie', setCookieHeader);
}
}

View file

@ -27,8 +27,8 @@ export function start(manifest: SSRManifest, options: Options) {
let ip = connInfo?.remoteAddr?.hostname;
Reflect.set(request, Symbol.for('astro.clientAddress'), ip);
const response = await app.render(request);
if(app.setCookieHeaders) {
for(const setCookieHeader of app.setCookieHeaders(response)) {
if (app.setCookieHeaders) {
for (const setCookieHeader of app.setCookieHeaders(response)) {
response.headers.append('Set-Cookie', setCookieHeader);
}
}
@ -46,8 +46,8 @@ export function start(manifest: SSRManifest, options: Options) {
// Render the astro custom 404 page
const response = await app.render(request);
if(app.setCookieHeaders) {
for(const setCookieHeader of app.setCookieHeaders(response)) {
if (app.setCookieHeaders) {
for (const setCookieHeader of app.setCookieHeaders(response)) {
response.headers.append('Set-Cookie', setCookieHeader);
}
}

View file

@ -111,12 +111,7 @@ class SquooshService extends BaseSSRService {
throw new Error(`Unknown image output: "${transform.format}" used for ${transform.src}`);
}
const data = await processBuffer(
inputBuffer,
operations,
transform.format,
transform.quality
);
const data = await processBuffer(inputBuffer, operations, transform.format, transform.quality);
return {
data: Buffer.from(data),

View file

@ -18,8 +18,8 @@ export function createExports(manifest: SSRManifest) {
const ip = request.headers.get('x-nf-client-connection-ip');
Reflect.set(request, clientAddressSymbol, ip);
const response = await app.render(request);
if(app.setCookieHeaders) {
for(const setCookieHeader of app.setCookieHeaders(response)) {
if (app.setCookieHeaders) {
for (const setCookieHeader of app.setCookieHeaders(response)) {
response.headers.append('Set-Cookie', setCookieHeader);
}
}

View file

@ -121,10 +121,10 @@ export const createExports = (manifest: SSRManifest, args: Args) => {
}
// Apply cookies set via Astro.cookies.set/delete
if(app.setCookieHeaders) {
if (app.setCookieHeaders) {
const setCookieHeaders = Array.from(app.setCookieHeaders(response));
fnResponse.multiValueHeaders = fnResponse.multiValueHeaders || {};
if(!fnResponse.multiValueHeaders['set-cookie']) {
if (!fnResponse.multiValueHeaders['set-cookie']) {
fnResponse.multiValueHeaders['set-cookie'] = [];
}
fnResponse.multiValueHeaders['set-cookie'].push(...setCookieHeaders);

View file

@ -42,9 +42,9 @@ export function createExports(manifest: SSRManifest) {
async function writeWebResponse(app: NodeApp, res: ServerResponse, webResponse: Response) {
const { status, headers, body } = webResponse;
if(app.setCookieHeaders) {
if (app.setCookieHeaders) {
const setCookieHeaders: Array<string> = Array.from(app.setCookieHeaders(webResponse));
if(setCookieHeaders.length) {
if (setCookieHeaders.length) {
res.setHeader('Set-Cookie', setCookieHeaders);
}
}

View file

@ -16,8 +16,8 @@ export function createExports(manifest: SSRManifest) {
if (app.match(request)) {
Reflect.set(request, clientAddressSymbol, request.headers.get('x-forwarded-for'));
const response = await app.render(request);
if(app.setCookieHeaders) {
for(const setCookieHeader of app.setCookieHeaders(response)) {
if (app.setCookieHeaders) {
for (const setCookieHeader of app.setCookieHeaders(response)) {
response.headers.append('Set-Cookie', setCookieHeader);
}
}

View file

@ -1,5 +1,5 @@
import type { IncomingMessage, ServerResponse } from 'node:http';
import type { App } from 'astro/app';
import type { IncomingMessage, ServerResponse } from 'node:http';
import { Readable } from 'node:stream';
const clientAddressSymbol = Symbol.for('astro.clientAddress');
@ -78,7 +78,11 @@ export async function getRequest(base: string, req: IncomingMessage): Promise<Re
return request;
}
export async function setResponse(app: App, res: ServerResponse, response: Response): Promise<void> {
export async function setResponse(
app: App,
res: ServerResponse,
response: Response
): Promise<void> {
const headers = Object.fromEntries(response.headers);
if (response.headers.has('set-cookie')) {
@ -86,9 +90,9 @@ export async function setResponse(app: App, res: ServerResponse, response: Respo
headers['set-cookie'] = response.headers.raw()['set-cookie'];
}
if(app.setCookieHeaders) {
if (app.setCookieHeaders) {
const setCookieHeaders: Array<string> = Array.from(app.setCookieHeaders(response));
if(setCookieHeaders.length) {
if (setCookieHeaders.length) {
res.setHeader('Set-Cookie', setCookieHeaders);
}
}