Skip to content

http

Utilities to perform HTTP requests

⚠️ WARNING: This API requires the --- @unsafe true metadata.

Functions

get(url : string, opt_headers : table): table

Performs a GET request

  • url (string) The URL to request
  • opt_headers (table) (optional) Request headers
  • returns (table) The response table:
KeytypeDescription
statusnumberThe HTTP status code
bodystringThe raw response body
headerstableA table of response headers

post(url : string, body : string, opt_headers : table): table

Performs a POST request

  • url (string) The URL to request
  • body (string) The request body
  • opt_headers (table) (optional) Request headers
  • returns (table) The response table:
KeytypeDescription
statusnumberThe HTTP status code
bodystringThe raw response body
headerstableA table of response headers