Skip to content

Commit ab5d9dc

Browse files
committed
Add support for user request options
1 parent ea5960c commit ab5d9dc

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/HttpClient.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import ApiError from "./types/ApiError";
2+
import { UserRequestOptions } from "./types/Params";
23

34
const { version } = require("../package.json");
45

@@ -20,6 +21,7 @@ export interface HttpClientRequestOptions {
2021
data?: any;
2122
params?: any;
2223
url: string;
24+
options?: UserRequestOptions;
2325
}
2426

2527
interface RequestHeaders {
@@ -107,6 +109,10 @@ export default class ApiClient implements HttpClient {
107109
baseUrl = requestOptions.baseUrl;
108110
}
109111

112+
if (requestOptions?.options?.warrantToken) {
113+
fetchRequestOptions.headers['Warrant-Token'] = requestOptions.options.warrantToken;
114+
}
115+
110116
let requestUrl = `${baseUrl}${requestOptions.url}`;
111117
if (requestOptions?.params) {
112118
const queryParams = new URLSearchParams(requestOptions.params);

src/types/Params.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export interface UserRequestOptions {
2+
warrantToken?: string;
3+
}

0 commit comments

Comments
 (0)