0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-27 22:19:04 -05:00

[ci] format

This commit is contained in:
natemoo-re 2023-06-06 15:11:47 +00:00 committed by fredkbot
parent 4929332c32
commit a1144f7fec
7 changed files with 217 additions and 221 deletions

View file

@ -112,7 +112,7 @@ function isInPagesDir(file: URL, config: AstroConfig): boolean {
function isInjectedRoute(file: URL, settings: AstroSettings) {
for (const route of settings.injectedRoutes) {
if(file.toString().endsWith(route.entryPoint)) return true;
if (file.toString().endsWith(route.entryPoint)) return true;
}
return false;
}

View file

@ -146,14 +146,11 @@ describe('Scripts (hoisted and not)', () => {
name: 'test-script-injection-with-injected-route',
hooks: {
'astro:config:setup': ({ injectRoute, injectScript }) => {
injectScript(
'page',
`import '/src/scripts/something.js';`
);
injectScript('page', `import '/src/scripts/something.js';`);
injectRoute({ pattern: 'injected-route', entryPoint: 'src/external-page.astro' });
},
},
}
},
],
vite: {
build: {

View file

@ -7,7 +7,9 @@ import type { OutgoingHttpHeaders } from 'http';
* @param webHeaders WebAPI Headers object
* @returns NodeJS OutgoingHttpHeaders object with multiple set-cookie handled as an array of values
*/
export const createOutgoingHttpHeaders = (webHeaders: Headers | undefined | null): OutgoingHttpHeaders | undefined => {
export const createOutgoingHttpHeaders = (
webHeaders: Headers | undefined | null
): OutgoingHttpHeaders | undefined => {
if (!webHeaders) {
return undefined;
}

View file

@ -60,9 +60,9 @@ export function createServer(
let location: string;
if (req.url!.includes('?')) {
const [url = '', search] = req.url!.split('?');
location = `${url}/?${search}`
location = `${url}/?${search}`;
} else {
location = req.url + '/'
location = req.url + '/';
}
res.statusCode = 301;

View file

@ -1,9 +1,9 @@
import type { NodeApp } from 'astro/app/node';
import type { IncomingMessage, ServerResponse } from 'http';
import type { Readable } from 'stream';
import { createOutgoingHttpHeaders } from './createOutgoingHttpHeaders';
import { responseIterator } from './response-iterator';
import type { Options } from './types';
import { createOutgoingHttpHeaders } from './createOutgoingHttpHeaders';
export default function (app: NodeApp, mode: Options['mode']) {
return async function (

View file

@ -3,7 +3,6 @@ import { expect } from 'chai';
import { createOutgoingHttpHeaders } from '../dist/createOutgoingHttpHeaders.js';
describe('createOutgoingHttpHeaders', () => {
it('undefined input headers', async () => {
const result = createOutgoingHttpHeaders(undefined);
expect(result).to.equal(undefined);
@ -74,5 +73,4 @@ describe('createOutgoingHttpHeaders', () => {
'set-cookie': ['hello', 'world'],
});
});
});

View file

@ -126,7 +126,6 @@ describe('Node Adapter Headers', () => {
'set-cookie': ['from1=response1', 'from2=response2', 'from3=astro1', 'from4=astro2'],
});
});
});
async function runTest(url, expectedHeaders) {