-
Notifications
You must be signed in to change notification settings - Fork 1
Request Body Classes
Dickson Law edited this page Apr 9, 2023
·
1 revision
These classes are meant to be used with the body parameter in request-sending functions.
An application/json request body encoded using json_stringify.
-
data: The data struct associated with this request body.
-
addValue(k, v): Add a new key-value pair to this request body. -
getBody(): Return the request body as a string.
new StructBody({
name: "Alice Anderson",
email: "alice.anderson@example.com",
})An application/x-www-form-urlencoded request body.
-
data: The data struct associated with this request body.
-
addValue(k, v): Add a new key-value pair to this request body. -
getBody(): Return the request body as a string.
new XwfuBody({
name: "Alice Anderson",
email: "alice.anderson@example.com",
})A multipart/form-data request body. Only with this body type can you attach files as multipart file parts in a key-value pair.
-
data: The data struct associated with this request body.
-
addValue(k, v): Add a new key-value pair to this request body. -
getBody(): Return the request body as a buffer. -
cleanBody(): Free the memory associated with the generated body buffer.
new MultipartBody({
name: "Alice Anderson",
email: "alice.anderson@example.com",
avatar: new FilePart("avatar.png"),
})An application/json request body encoded using the JSON Structs library.
IMPORTANT: Please use StructBody instead if you are not using the JSON Structs library.
-
data: The data struct associated with this request body.
-
addValue(k, v): Add a new key-value pair to this request body. -
getBody(): Return the request body as a string.
new JsonBody({
name: "Alice Anderson",
email: "alice.anderson@example.com",
})