Skip to content

Commit a12c68f

Browse files
committed
feat: allow custom headers in apiRequest
1 parent 82bdb20 commit a12c68f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

mlflow/src/utils/apiRequest.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ interface RequestOptions {
22
method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
33
body?: Record<string, unknown>;
44
params?: Record<string, string>;
5+
headers?: Record<string, string>;
56
}
67

78
interface ApiResponse<T = any> {
@@ -23,12 +24,13 @@ export async function apiRequest<T = any>(
2324
options: RequestOptions
2425
): Promise<ApiResponse<T>> {
2526
let url = `${baseUrl}/api/2.0/mlflow/${endpoint}`;
26-
const { method, body, params } = options;
27+
const { method, body, params, headers } = options;
2728

2829
const fetchOptions: RequestInit = {
2930
method,
3031
headers: {
3132
'Content-Type': 'application/json',
33+
...headers,
3234
},
3335
};
3436

@@ -47,4 +49,3 @@ export async function apiRequest<T = any>(
4749
return { response, data };
4850
}
4951

50-

0 commit comments

Comments
 (0)