Skip to main content

Headers


Request Headers

We can set the headers in two ways - when creating the command, or dynamically through .setHeaders( method.


Example

const getUsers = builder.createCommand()({
endpoint: "/users",
headers: {
"Content-Type": "application/json",
},
});
console.log(getUsers.headers); // Output: { "Content-Type": "application/json" }
const command = createUser.setHeaders({
"Content-Type": "application/json",
});
console.log(command.headers); // Output: { "Content-Type": "application/json" }