handle.getResponseHeaders
Returns a table containing the response’s headers, in a format similar to that required by http.request. If multiple headers are sent with the same name, they will be combined with a comma.
|
|||
Gets the response headers of "https://example.com" and print it. | |||
Code | local response, err = http.get("https://example.com")
if not response then error(err, 0) end
local headers = response.getResponseHeaders()
print(headers["Content-Type"])
print(headers["Content-Length"])
|
||
Output | text/html 1270 |
Functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Lua |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CC:Tweaked |
|
handle.getResponseHeaders Function | |
---|---|
Syntax handle.getResponseHeaders() | |
Returns | table headers |
API | http |
Source | CC:Tweaked (source) |
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.