string
string: (ResponseBody) -> stringThe body as text: a byte order mark decides the charset, then the Content-Type charset, then UTF-8.
| Method | Returns | Description |
|---|---|---|
string() | string | The body as text: a byte order mark decides the charset, then the Content-Type charset, then UTF-8. |
contentLength() | number | The body's length in bytes (decompressed: it is all in memory). |
contentType() | MediaType? | The Content-Type, or nil. |
close() | () | Close it: it cannot be read after. |
bytes() | string | The body's bytes, as a Luau string (a Luau string holds any bytes, so ImageUtil.fromBytes(body:bytes()) reads an image). Reads once, as `… |
| Method | Returns | Description |
|---|---|---|
Response.body | ResponseBody? | The body (readable once). |
stringstring: (ResponseBody) -> stringThe body as text: a byte order mark decides the charset, then the Content-Type charset, then UTF-8.
contentLengthcontentLength: (ResponseBody) -> numberThe body's length in bytes (decompressed: it is all in memory).
contentTypecontentType: (ResponseBody) -> MediaType?The Content-Type, or nil.
closeclose: (ResponseBody) -> ()Close it: it cannot be read after.
bytesbytes: (ResponseBody) -> stringThe body's bytes, as a Luau string (a Luau string holds any bytes, so ImageUtil.fromBytes(body:bytes()) reads an image). Reads once, as string() does.