Session class represents a HTTP session. It provides methods to perform various HTTP requests.

Constructors

Properties

alpnProtocols?: string[]
alpsProtocols: string[]
certCompressionAlgo?: CertCompressionAlgo
clientIdentifier?: ClientIdentifier
connectionFlow?: number
debug?: boolean
disableIPV4: boolean
disableIPV6: boolean
fetch: Promise<koffiLoad>
forceHttp1?: boolean
h2Settings?: H2Settings
h2SettingsOrder?: (keyof H2Settings)[]
headerOrder?: string[]
headerPriority?: PriorityParam
headers: OutgoingHttpHeaders
insecureSkipVerify?: boolean
ja3string?: string
jar: Cookies = ...
keyShareCurves?: KeyShareCurves[]
priorityFrames?: PriorityFrames[]
proxy?: null | string
pseudoHeaderOrder?: PseudoHeaderOrder[]
randomTlsExtensionOrder?: boolean
sessionId?: string
supportedSignatureAlgorithms?: SupportedSignatureAlgorithms[]
supportedVersions?: SupportedVersions[]
timeout: null | number

Accessors

  • get cookies(): Serialized
  • Retrieves all cookies from the jar.

    This getter fetches all cookies stored in the jar instance of the class.

    Returns Serialized

    An object where keys are URLs and values are objects containing cookies as key-value pairs.

    Example

    { 
    "https://example.com/": {
    "cookie1": "value1",
    "cookie2": "value2"
    },
    "https://anotherdomain.com/": {
    "cookieA": "valueA",
    "cookieB": "valueB"
    }
    }

Methods

  • The 'close' method closes the current session.

    Returns Promise<any>

    The response from the 'destroySession' function.

  • The 'delete' method performs a DELETE request to the provided URL with the provided options.

    Parameters

    • url: string

      The URL to perform the DELETE request to.

    • Optional options: DeleteRequestOptions

      The options for the DELETE request.

    Returns Promise<Response>

    The response from the 'execute' method.

  • The 'execute' method performs a HTTP request of the provided method to the provided URL with the provided options.

    Parameters

    • method: Methods

      The HTTP method of the request.

    • url: string

      The URL to perform the request to.

    • options: RequestOptions

      The options for the request.

    Returns Promise<Response>

    A new Response object.

  • The 'freeMemory' method frees the memory used by the session with the provided id.

    Parameters

    • id: string

      The id of the session to free the memory of.

    Returns Promise<void>

    The response from the 'destroySession' function.

  • The 'get' method performs a GET request to the provided URL with the provided options.

    Parameters

    • url: string

      The URL to perform the GET request to.

    • Optional options: GetRequestOptions

      The options for the GET request.

    Returns Promise<Response>

    The response from the 'execute' method.

  • The 'head' method performs a HEAD request to the provided URL with the provided options.

    Parameters

    • url: string

      The URL to perform the HEAD request to.

    • Optional options: HeadRequestOptions

      The options for the HEAD request.

    Returns Promise<Response>

    The response from the 'execute' method.

  • The 'options' method performs an OPTIONS request to the provided URL with the provided options.

    Parameters

    • url: string

      The URL to perform the OPTIONS request to.

    • Optional options: OptionsRequestOptions

      The options for the OPTIONS request.

    Returns Promise<Response>

    The response from the 'execute' method.

  • The 'patch' method performs a PATCH request to the provided URL with the provided options.

    Parameters

    • url: string

      The URL to perform the PATCH request to.

    • Optional options: PatchRequestOptions

      The options for the PATCH request.

    Returns Promise<Response>

    The response from the 'execute' method.

  • The 'post' method performs a POST request to the provided URL with the provided options.

    Parameters

    • url: string

      The URL to perform the POST request to.

    • Optional options: PostRequestOptions

      The options for the POST request.

    Returns Promise<Response>

    The response from the 'execute' method.

  • The 'put' method performs a PUT request to the provided URL with the provided options.

    Parameters

    • url: string

      The URL to perform the PUT request to.

    • Optional options: PutRequestOptions

      The options for the PUT request.

    Returns Promise<Response>

    The response from the 'execute' method.