-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Could we please add 'Authorization': Bearer ${process.env.MLFLOW_TRACKING_TOKEN}, to apiRequest.js so it supports Authentication
## /mlflow-js/mlflow/lib/utils/apiRequest.js
/**
* Utility function for making API requests to the MLflow server.
*
* @param baseUrl - The base URL of the MLflow server
* @param endpoint - The API endpoint
* @param options - Request options
* @returns A promise that resolves to the response and data
*/
export async function apiRequest(baseUrl, endpoint, options) {
let url = `${baseUrl}/api/2.0/mlflow/${endpoint}`;
const { method, body, params } = options;
const fetchOptions = {
method,
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${process.env.MLFLOW_TRACKING_TOKEN}`,
},
};
if (body) {
fetchOptions.body = JSON.stringify(body);
}
if (params) {
const searchParams = new URLSearchParams(params);
url += `?${searchParams.toString()}`;
}
const response = await fetch(url, fetchOptions);
const data = (await response.json());
return { response, data };
}
//# sourceMappingURL=apiRequest.js.mapMetadata
Metadata
Assignees
Labels
No labels