Files
boc/vims-backend/node_modules/@aws-sdk/credential-provider-http/dist-es/fromHttp/fromHttp.browser.js
T
Bernt 6de2455917 v1.2.0: Add Global Markets footer, translated to 9 languages
- Added GLOBAL_MARKETS_TITLE to all translation files
- Updated footer with 12 markets (4 active + 8 upcoming)
- Translated market section to: zh-cn, zh-tw, ja, ko, th, vi, id, ms, hi
- Built and deployed to production
- CloudFront invalidation: I3RTMXVFDJXWLG3SYX208OP1CC
2026-07-08 19:56:03 +00:00

28 lines
1.1 KiB
JavaScript

import { CredentialsProviderError } from "@smithy/core/config";
import { FetchHttpHandler } from "@smithy/fetch-http-handler";
import { checkUrl } from "./checkUrl";
import { createGetRequest, getCredentials } from "./requestHelpers";
import { retryWrapper } from "./retry-wrapper";
export const fromHttp = (options = {}) => {
options.logger?.debug("@aws-sdk/credential-provider-http - fromHttp");
let host;
const full = options.credentialsFullUri;
if (full) {
host = full;
}
else {
throw new CredentialsProviderError("No HTTP credential provider host provided.", { logger: options.logger });
}
const url = new URL(host);
checkUrl(url, options.logger);
const requestHandler = new FetchHttpHandler();
return retryWrapper(async () => {
const request = createGetRequest(url);
if (options.authorizationToken) {
request.headers.Authorization = options.authorizationToken;
}
const result = await requestHandler.handle(request);
return getCredentials(result.response);
}, options.maxRetries ?? 3, options.timeout ?? 1000);
};