Documentation
    Preparing search index...

    Interface IConnection<Headers>

    Connection information.

    IConnection is an interface type that represents connection information of the remote HTTP server. You can target the remote HTTP server by writing 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/192/256 algorithm, specify the IConnection.encryption with IEncryptionPassword or IEncryptionPassword.Closure variable.

    Jeongho 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 | undefined> & Headerify<Headers>;
        host: string;
        logger?: (event: IFetchEvent) => Promise<void>;
        options?: IConnection.IOptions;
        simulate?: boolean;
    }

    Type Parameters

    • Headers extends object | undefined = object | undefined
    Index

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

    Header values delivered to the remote HTTP server; undefined entries are omitted.

    host: string

    Host address of the remote HTTP server.

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

    Logger function.

    This function is called and awaited after transport and response processing, whether they succeeded or failed. Configuration, body encoding and URL errors that occur before transport do not produce an event. Logger errors are ignored; event input and output share the caller's payload references, so a logger should treat them as read-only.

    Type Declaration

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

        • event: IFetchEvent

          Event information of the fetch event.

        Returns Promise<void>

    contracts/common.md#principled-implementation The callback receives the event from the transport finally block after completed_at is set. respond_at and status stay null without a response, and output stays undefined if body processing throws. Its rejection is ignored, but its argument includes mutable payload references and its awaiting can delay completion.

    contracts/common.md#clear-and-simple-design One optional callback with a single event argument.

    contracts/common.md#prohibited-implementation-shortcuts The optional callback uses the connection's supported logging boundary; the pipeline catches its errors without replacing a transport or decoding failure.

    contracts/common.md#meaningful-documentation The comment states when the callback runs, which pretransport errors create no event, that it is awaited, and why shared payload references should be treated as read-only.

    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. Then, newly generated SDK library would have a built-in mock-up data generator.

    false