[ci] format
This commit is contained in:
parent
21e0757ea2
commit
b18d4bf3b1
3 changed files with 20 additions and 24 deletions
|
@ -91,12 +91,8 @@ export function createAPIContext({
|
||||||
|
|
||||||
type ResponseParameters = ConstructorParameters<typeof Response>;
|
type ResponseParameters = ConstructorParameters<typeof Response>;
|
||||||
|
|
||||||
export class ResponseWithEncoding extends Response {
|
export class ResponseWithEncoding extends Response {
|
||||||
constructor(
|
constructor(body: ResponseParameters[0], init: ResponseParameters[1], encoding?: BufferEncoding) {
|
||||||
body: ResponseParameters[0],
|
|
||||||
init: ResponseParameters[1],
|
|
||||||
encoding?: BufferEncoding
|
|
||||||
) {
|
|
||||||
// If a body string is given, try to encode it to preserve the behaviour as simple objects.
|
// If a body string is given, try to encode it to preserve the behaviour as simple objects.
|
||||||
// We don't do the full handling as simple objects so users can control how headers are set instead.
|
// We don't do the full handling as simple objects so users can control how headers are set instead.
|
||||||
if (typeof body === 'string') {
|
if (typeof body === 'string') {
|
||||||
|
@ -116,7 +112,7 @@ type ResponseParameters = ConstructorParameters<typeof Response>;
|
||||||
this.headers.set('X-Astro-Encoding', encoding);
|
this.headers.set('X-Astro-Encoding', encoding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function callEndpoint<MiddlewareResult = Response | EndpointOutput>(
|
export async function callEndpoint<MiddlewareResult = Response | EndpointOutput>(
|
||||||
mod: EndpointHandler,
|
mod: EndpointHandler,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import crypto from 'node:crypto';
|
|
||||||
import buffer from 'node:buffer';
|
import buffer from 'node:buffer';
|
||||||
|
import crypto from 'node:crypto';
|
||||||
|
|
||||||
export function apply() {
|
export function apply() {
|
||||||
// Remove when Node 18 is dropped for Node 20
|
// Remove when Node 18 is dropped for Node 20
|
||||||
|
|
Loading…
Add table
Reference in a new issue