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
Name | Type | Description | Optional | Default Value |
---|---|---|---|---|
headers | Headers | Headers to merge with existing defaults | No | N/A |
Example
const client = new LunexClient('https://api.example.com');
// Set authorization header globally
client.setHeaders({
Authorization: 'Bearer YOUR_NEW_TOKEN',
});