Represents a model for HTTP requests. This class encapsulates all necessary details such as URL, method, path, query parameters, body, headers, scheme, port, and timeout settings.

Constructors

  • Constructs an instance of the RequestModel.

    Parameters

    • url: string

      The base URL of the HTTP request.

    • method: string = 'GET'

      HTTP method, default is 'GET'.

    • path: string

      URL path.

    • query: Record<string, dynamic>

      Query parameters as a record of key-value pairs.

    • body: Record<string, dynamic>

      Body of the request as a record of key-value pairs.

    • headers: Record<string, string>

      HTTP headers as a record of key-value pairs.

    • scheme: string = HTTP

      Protocol scheme, default is 'http'.

    • port: number

      Port number, default is 80.

    Returns RequestModel

Properties

body: Record<string, dynamic>
headers: Record<string, string>
method: string
path: string
port: number
query: Record<string, dynamic>
scheme: string
timeout: number
url: string

Methods

  • Constructs the options for the HTTP request based on the current state of the model. This method is used to prepare the request options for execution.

    Returns Record<string, any>

    A record containing all relevant options for the HTTP request.