[ci] format
This commit is contained in:
parent
0883fd4875
commit
6916e5c79f
2 changed files with 6 additions and 6 deletions
|
@ -57,7 +57,7 @@ export async function writeWebResponse(res: http.ServerResponse, webResponse: Re
|
||||||
|
|
||||||
// Attach any set-cookie headers added via Astro.cookies.set()
|
// Attach any set-cookie headers added via Astro.cookies.set()
|
||||||
const setCookieHeaders = Array.from(getSetCookiesFromResponse(webResponse));
|
const setCookieHeaders = Array.from(getSetCookiesFromResponse(webResponse));
|
||||||
if(setCookieHeaders.length) {
|
if (setCookieHeaders.length) {
|
||||||
// Always use `res.setHeader` because headers.append causes them to be concatenated.
|
// Always use `res.setHeader` because headers.append causes them to be concatenated.
|
||||||
res.setHeader('set-cookie', setCookieHeaders);
|
res.setHeader('set-cookie', setCookieHeaders);
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ describe('API routes in SSR', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Can set multiple headers of the same type', async () => {
|
it('Can set multiple headers of the same type', async () => {
|
||||||
const response = await new Promise(resolve => {
|
const response = await new Promise((resolve) => {
|
||||||
let { port } = devServer.address;
|
let { port } = devServer.address;
|
||||||
let host = 'localhost';
|
let host = 'localhost';
|
||||||
let socket = new net.Socket();
|
let socket = new net.Socket();
|
||||||
|
@ -107,8 +107,8 @@ describe('API routes in SSR', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
let rawResponse = '';
|
let rawResponse = '';
|
||||||
socket.setEncoding('utf-8')
|
socket.setEncoding('utf-8');
|
||||||
socket.on('data', chunk => {
|
socket.on('data', (chunk) => {
|
||||||
rawResponse += chunk.toString();
|
rawResponse += chunk.toString();
|
||||||
socket.destroy();
|
socket.destroy();
|
||||||
});
|
});
|
||||||
|
@ -119,11 +119,11 @@ describe('API routes in SSR', () => {
|
||||||
|
|
||||||
let count = 0;
|
let count = 0;
|
||||||
let exp = /set-cookie\:/g;
|
let exp = /set-cookie\:/g;
|
||||||
while(exp.exec(response)) {
|
while (exp.exec(response)) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(count).to.equal(2, 'Found two seperate set-cookie response headers')
|
expect(count).to.equal(2, 'Found two seperate set-cookie response headers');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue