Lua Legacy Fetch

This global function fetches content from the web in a synchronous way.

This is part of the legacy api which is deprecated and no longer maintained.

local res = fetch({
  url = "https://dns.webxplus.org/resolve/search/app",
  method = "GET",
  headers = { ["Content-Type"] = "application/json" },
  body = '{ "test": "cat" }'
})

Inputs

  • Options
    • URL - The url to fetch
    • Method - Any valid http method (Optional)
    • Headers - Headers to use in the request (Optional)
    • Body - A body in the request (Ignored for GET and HEAD) (Optional)

Return

String or Table (JSON/Object like structure) depending on the response of the fetch.

Support

  Napture Bussinga YAB WXV Core
fetch v1.0.0 v0.0.1 None 1
url v1.0.0 v0.0.1 None 1
method v1.0.0 v0.0.1 None 1
headers v1.0.0 v0.0.1 None 1
body v1.0.0 v0.0.1 None 1

*fetch some issues around sync present
*method Napture only supports GET, POST, PUT, DELETE