ResponseBody

Group
http
Methods
5
Fields
None

Methods

MethodReturnsDescription
string()stringThe body as text: a byte order mark decides the charset, then the Content-Type charset, then UTF-8.
contentLength()numberThe 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()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 `…

Returned by

MethodReturnsDescription
Response.bodyResponseBody?The body (readable once).

Method details

string

string: (ResponseBody) -> string

The body as text: a byte order mark decides the charset, then the Content-Type charset, then UTF-8.

bytes

bytes: (ResponseBody) -> 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 string() does.