UNPKG

nyro

Version:

A simple and effective promise-based HTTP & HTTP/2 request library that supports all HTTP methods.

32 lines (31 loc) 1.19 kB
/** * @file Utility functions for handling HTTP responses and system information. */ import { IncomingMessage } from 'http'; /** * Checks if the socket used for the response was reused. * * @param res - The HTTP response object. * @returns A boolean indicating if the socket was reused, or undefined if the information is not available. */ export declare function getReusedSocket(res: any): boolean | undefined; /** * Retrieves the IP address of the server from the HTTP response. * * @param res - The HTTP response object. * @returns The server's IP address as a string, or undefined if the information is not available. */ export declare function getServerIp(res: IncomingMessage): string | undefined; /** * Generates a default User-Agent string based on the current system's platform, architecture, and Node.js version. * * @returns A string representing the default User-Agent. */ export declare function getDefaultUserAgent(): string; /** * Generates a unique ID based on the current timestamp and a random number. * * @returns A unique ID string. * @example generateUniqueId() // 'id-1633456789000-123456' */ export declare function generateUniqueId(): string;