Setu-TS
    Preparing search index...

    Interface InjectRequest

    Inject request shape for IKernelApplication.inject.

    0.1.0

    interface InjectRequest {
        body?:
            | string
            | Record<string, unknown>
            | ArrayBuffer
            | Uint8Array<ArrayBufferLike>
            | URLSearchParams
            | Blob;
        headers?: Record<string, string> | Headers;
        ip?: string;
        method: string;
        url: string;
    }
    Index
    body?:
        | string
        | Record<string, unknown>
        | ArrayBuffer
        | Uint8Array<ArrayBufferLike>
        | URLSearchParams
        | Blob

    Request body. Carried VERBATIM for every byte-ish shape, but the content-type default differs between them: a Uint8Array and an ArrayBuffer get NONE, since only the caller knows whether those bytes are multipart, JSON, or an image, while a Blob DECLARES its own and contributes a non-empty .type as the default — matching the platform, whose new Request(url, { body: blob }) sets the header from it and omits it when the blob has none. A URLSearchParams is serialised with its own toString() and defaults the content type to application/x-www-form-urlencoded; a plain object is JSON-serialised and a bare string is carried as-is, both defaulting to application/json. An explicitly supplied content type always wins, and the default is written onto a COPY of headers, so a Headers instance reused across two injected requests is never mutated.

    Any other shape — an array, a Date, a class instance, a number — is REFUSED with a TypeError naming the received type, rather than silently JSON-stringified as before (which turned a Uint8Array into {"0":97,…} and every other non-string into {}).

    The last arm is deliberately Record<string, unknown>, not object: object admits arrays, Dates, streams and every class instance, so the union would go on accepting exactly the values that used to silently JSON-coerce.

    headers?: Record<string, string> | Headers

    Request headers.

    ip?: string

    Socket peer to carry into IRequest.ip; omitted by default.

    method: string

    HTTP method.

    url: string

    Full request URL.