Skip to main content

setHeaders

The setHeaders method updates the default HTTP headers for the LunexClient instance. This is useful for setting or modifying headers like Authorization or API keys that should be included in all requests.


Method Signature​

public setHeaders(headers: Headers): void

Parameters​

NameTypeDescriptionOptionalDefault Value
headersHeadersHeaders to merge with existing defaultsNoN/A

Example​

const client = new LunexClient('https://api.example.com');

// Set authorization header globally
client.setHeaders({
Authorization: 'Bearer YOUR_NEW_TOKEN',
});