Documentation
    Preparing search index...

    Interface IConnection<Headers>

    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 IConnection.host variable down. Also, you can configure special header values by specializing the IConnection.headers variable.

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

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

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

    interface IConnection<Headers extends object | undefined = object | undefined> {
        encryption?: IEncryptionPassword | IEncryptionPassword.Closure;
        fetch?: {
            (input: URL | RequestInfo, init?: RequestInit): Promise<Response>;
            (input: string | URL | Request, init?: RequestInit): Promise<Response>;
        };
        headers?: Record<string, HeaderValue> & Headerify<Headers>;
        host: string;
        logger?: (event: IFetchEvent) => Promise<void>;
        options?: IOptions;
        simulate?: boolean;
    }

    Type Parameters

    • Headers extends object | undefined = object | undefined
    Index

    Properties

    Encryption password of its closure function.

    Define it only when target backend server is encrypting body data through @EncryptedRoute or @EncryptedBody decorators of @nestia/core for security reason.

    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> & Headerify<Headers>

    Header values delivered to the remote HTTP server.

    host: string

    Host address of the remote HTTP server.

    logger?: (event: IFetchEvent) => Promise<void>

    Logger function.

    This function is called when the fetch event is completed.

    Type Declaration

      • (event: IFetchEvent): Promise<void>
      • Parameters

        • event: IFetchEvent

          Event information of the fetch event.

        Returns Promise<void>

    options?: IOptions

    Additional options for the fetch function.

    simulate?: boolean

    Use simulation mode.

    If you configure this property to be true, your SDK library does not send any request to remote backend server, but just returns random data generated by typia.random<T>() function with request data validation.

    By the way, to utilize this simulation mode, SDK library must be generated with INestiaConfig.simulate option, too. Open nestia.config.ts file, and configure INestiaConfig.simulate property to be true. Them, newly generated SDK library would have a built-in mock-up data generator.

    false