Headers
Request Headers
We can set the headers in two ways - when creating the request, or dynamically through .setHeaders(
method.
Example
const getUsers = client.createRequest()({
endpoint: "/users",
headers: {
"Content-Type": "application/json",
},
});
console.log(getUsers.headers); // Output: { "Content-Type": "application/json" }
const request = createUser.setHeaders({
"Content-Type": "application/json",
});
console.log(request.headers); // Output: { "Content-Type": "application/json" }
Directly on send method
const response = getUser.send({
headers: {
"Content-Type": "application/json",
},
});