Skip to main content

HTTP

http.create_request

Creates a new HTTP request.

  • Parameters:

    NameTypeDescription
    methodHttpMethod_tMethod type (GET, POST, etc.)
    urlstringThe URL to which the request will be sent.
  • Return:

    TypeDescription
    HttpHandle_tThe handle to the newly created HTTP request.
  • Methods:

    • http.create_request(method, url)

http.send

Sends a HTTP request.

  • Parameters:

    NameTypeDescription
    handleHttpHandle_tThe handle to the HTTP request.
    on_responsefunctionThe callback function to handle the response.
  • Return:

    TypeDescription
    booleanReturns true if the request was successfully sent.
  • Methods:

    • http.send(handle, on_response)

http.release

Releases a HTTP request.

  • Parameters:

    NameTypeDescription
    requestHttpHandle_tThe handle to the HTTP request to be released.
  • Return:

    TypeDescription
    booleanReturns true if the request was successfully released.
  • Methods:

    • http.release(request)

http.is_busy

Checks if the HTTP request is currently being processed.

  • Parameters:

    NameTypeDescription
    requestHttpHandle_tThe handle to the HTTP request.
  • Return:

    TypeDescription
    booleanReturns true if the request is currently busy (being sent); otherwise, returns false.
  • Methods:

    • http.is_busy(request)

http.set_context

Sets a context value for the HTTP request.

  • Parameters:

    NameTypeDescription
    requestHttpHandle_tThe handle to the HTTP request.
    valuenumberThe context value to set.
  • Return:

    TypeDescription
    booleanReturns true if the context value was successfully set.
  • Methods:

    • http.set_context(request, value)

http.set_header

Sets a header value for the HTTP request.

  • Parameters:

    NameTypeDescription
    requestHttpHandle_tThe handle to the HTTP request.
    namestringThe name of the header.
    valuestringThe value of the header.
  • Return:

    TypeDescription
    booleanReturns true if the header was successfully set.
  • Methods:

    • http.set_header(request, name, value)

http.set_body

Sets the body of an HTTP request.

  • Parameters:

    NameTypeDescription
    requestHttpHandle_tThe handle to the HTTP request.
    bodystringThe data to be sent as the body of the request.
  • Return:

    TypeDescription
    booleanReturns true if the body was successfully set, otherwise returns false.
  • Methods:

    • http.set_body(request, body)

http.get

Performs an asynchronous HTTP GET request.

  • Parameters:

    NameTypeDescription
    urlstringThe URL to request.
    on_responsefunctionThe callback function to handle the response.
  • Methods:

    • http.get(url, on_response)

http.post

Performs an asynchronous HTTP POST request.

  • Parameters:

    NameTypeDescription
    urlstringThe URL to send data to.
    bodystringThe data to be sent in the body of the POST request.
    on_responsefunctionThe callback function to handle the response.
  • Methods:

    • http.post(url, body, on_response)

http.head

Performs an asynchronous HTTP HEAD request.

  • Parameters:

    NameTypeDescription
    urlstringThe URL to request.
    on_responsefunctionThe callback function to handle the response.
  • Methods:

    • http.head(url, on_response)