http Module
Basic LuaSocket HTTP support. Currently only supports the simple version of http.request(url , body)
Not all types are directly as module fields. Some types are only returned by calling functions, or accessing class fields. For example, EventArg type classes are generally not ever directly exposed, because you'll never need to directly create them, they will always be provided to you as needed. Types that are not globally exposed won't be listed below, use the site navigation on the left to browser all defined types.
Tip
In most cases the name that a type is exposed as will match the type name, but there are some cases where the name has been changed to prevent conflicts.
In the tables below, you can see the types that are exposed directly, and the names they are expose as.
Methods:
InternalRequest(url: string, body: string) : HttpResponseData
Request(url: string, body?: string = nil) : HttpResponseData
If the first argument of the request function is a string, it should be an url. In that case, if a body is provided as a string, the function will perform a POST method in the url. Otherwise, it performs a GET in the url. In case of failure, the function returns nil followed by an error message. If successful, returns a lua table with like following: { body: "", status: 200, headers: {} }
Name | Type | Default | Summary |
url | string | The url to request. | |
body | string | nil | Optional JSON body to post. |