Interface IHttpConnection

Connection information.

IConnection is an interface ttype who represents connection information of the remote HTTP server. You can target the remote HTTP server by wring the IHttpConnection.host variable down. Also, you can configure special header values by specializing the IHttpConnection.headers variable.

If the remote HTTP server encrypts or decrypts its body data through the AES-128/256 algorithm, specify the IHttpConnection.encryption with IEncryptionPassword or IEncryptionPassword.Closure variable.

Jenogho Nam - https://github.com/samchon

Seungjun We - https://github.com/SeungjunWe

interface IHttpConnection {
    fetch?: {
        (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
        (input: string | URL | Request, init?: RequestInit): Promise<Response>;
    };
    headers?: Record<string, HeaderValue>;
    host: string;
    options?: IHttpConnection.IOptions;
}

Properties

fetch?: {
    (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
    (input: string | URL | Request, init?: RequestInit): Promise<Response>;
}

Custom fetch function.

If you want to use custom fetch function instead of built-in, assign your custom fetch function into this property.

For reference, the fetch function has started to be supported since version 20 of NodeJS. Therefore, if you are using NodeJS version 19 or lower, you have to assign the node-fetch module into this property.

Type declaration

    • (input: URL | RequestInfo, init?: RequestInit): Promise<Response>
    • Parameters

      • input: URL | RequestInfo
      • Optionalinit: RequestInit

      Returns Promise<Response>

    • (input: string | URL | Request, init?: RequestInit): Promise<Response>
    • Parameters

      • input: string | URL | Request
      • Optionalinit: RequestInit

      Returns Promise<Response>

headers?: Record<string, HeaderValue>

Header values delivered to the remote HTTP server.

host: string

Host address of the remote HTTP server.

Additional options for the fetch function.