Pass Object to http_response event
WolfGang Senizen
Provide
http_response
event with an object representing the request instead of the LSL parameters request_id
, status
, metadata
, body
I'd propose if possible an object with the following structure
type HTTPResponse = {
id: uuid,
status : integer,
meta: {},
length: number, -- length of body
getBody: (self: HTTPResponse) -> string, -- retrieves body
... -- other common headers
}
Example use
LLEvents:on("http_request",function(response)
print("Body Length", response.length)
if request.length < 500 then
print("Body", response:getBody())
end
end)
This would make http responses safer and easier to manage especially with large bodies no longer risking oom's
(yes you can limit response body size, but this would match the "standard" if my feature request for
http_request
is done too :P)Log In
Nexii Malthus
I guess also a
response:getHeaders()
to get a object of headers and response:getHeader("âŚ")
to get a specific one (just like llGetHTTPHeader
)