[ci] format
This commit is contained in:
parent
61e1a267a8
commit
b5b95e4fb4
5 changed files with 11 additions and 9 deletions
|
@ -132,16 +132,16 @@ export interface AstroGlobal extends AstroGlobalPartial {
|
|||
*/
|
||||
request: Request;
|
||||
/** Information about the outgoing response. This is a standard [ResponseInit](https://developer.mozilla.org/en-US/docs/Web/API/Response/Response#init) object
|
||||
*
|
||||
*
|
||||
* For example, to change the status code you can set a different status on this object:
|
||||
* ```typescript
|
||||
* Astro.response.status = 404;
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#astroresponse)
|
||||
*/
|
||||
response: ResponseInit & {
|
||||
readonly headers: Headers
|
||||
readonly headers: Headers;
|
||||
};
|
||||
/** Redirect to another page (**SSR Only**)
|
||||
*
|
||||
|
|
|
@ -112,7 +112,7 @@ export class App {
|
|||
let headers = init.headers as Headers;
|
||||
let bytes = this.#encoder.encode(html);
|
||||
headers.set('Content-Type', 'text/html');
|
||||
headers.set('Content-Length', bytes.byteLength.toString())
|
||||
headers.set('Content-Length', bytes.byteLength.toString());
|
||||
return new Response(bytes, init);
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,9 @@ export interface RenderOptions {
|
|||
|
||||
export async function render(
|
||||
opts: RenderOptions
|
||||
): Promise<{ type: 'html'; html: string, response: ResponseInit; } | { type: 'response'; response: Response }> {
|
||||
): Promise<
|
||||
{ type: 'html'; html: string; response: ResponseInit } | { type: 'response'; response: Response }
|
||||
> {
|
||||
const {
|
||||
links,
|
||||
logging,
|
||||
|
@ -162,6 +164,6 @@ export async function render(
|
|||
return {
|
||||
type: 'html',
|
||||
html,
|
||||
response: result.response
|
||||
response: result.response,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ export interface SSROptions {
|
|||
export type ComponentPreload = [SSRLoadedRenderer[], ComponentInstance];
|
||||
|
||||
export type RenderResponse =
|
||||
| { type: 'html'; html: string, response: ResponseInit }
|
||||
| { type: 'html'; html: string; response: ResponseInit }
|
||||
| { type: 'response'; response: Response };
|
||||
|
||||
const svelteStylesRE = /svelte\?svelte&type=style/;
|
||||
|
|
|
@ -104,7 +104,7 @@ export function createResult(args: CreateResultArgs): SSRResult {
|
|||
|
||||
const url = new URL(request.url);
|
||||
const canonicalURL = createCanonicalURL('.' + pathname, site ?? url.origin);
|
||||
const response: ResponseInit = {
|
||||
const response: ResponseInit = {
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: new Headers(),
|
||||
|
@ -215,7 +215,7 @@ ${extra}`
|
|||
renderers,
|
||||
pathname,
|
||||
},
|
||||
response
|
||||
response,
|
||||
};
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue