Skip to main content
Version: 3.x.x

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" }