Skip to content

Commit

Permalink
Merge pull request #70 from commercelayer/headers
Browse files Browse the repository at this point in the history
Add custom header types
  • Loading branch information
marcomontalbano committed Mar 21, 2024
2 parents 5da8de6 + 3878632 commit 0c94c4f
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions packages/js-auth/src/types/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,31 @@ export interface TBaseOptions {
*/
domain?: string
/**
* The request headers.
* An optional object containing the HTTP request headers to be sent with the request.
*/
headers?: HeadersInit
headers?: {
/**
* Optional header for backend authentication. This key is mandatory for using the `x-true-client-ip` header
* to forward the client IP address, which helps in managing rate limits effectively by identifying
* unique client requests.
*
* **Note: This is an enterprise feature.**
*/
'x-backend-auth'?: string
/**
* Optional header to forward the client IP address in server-side requests. Its use requires the presence of
* the `x-backend-auth` header for authentication. This approach helps to differentiate between client requests
* and manage rate limits based on individual client IP addresses rather than the server's IP address alone.
*
* **Note: This is an enterprise feature.**
*/
'x-true-client-ip'?: string
/**
* Allows for additional headers as needed, where each key is the header name and the value is the header content.
* Header values should be strings, or `undefined` if the header is not set.
*/
[key: string]: string | undefined
}
}

export interface TBaseReturn {
Expand Down

0 comments on commit 0c94c4f

Please sign in to comment.