Skip to content

Commit 44a9218

Browse files
authored
feat(sdk-api): add method to create request for public AMS endpoints
2 parents dda9a9f + 617b0fd commit 44a9218

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

modules/sdk-api/src/bitgoAPI.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2102,4 +2102,27 @@ export class BitGoAPI implements BitGoBase {
21022102
// use defaultConstants as the backup for keys that are not set in this._constants
21032103
return _.merge({}, defaultConstants(this.getEnv()), BitGoAPI._constants[this.getEnv()]);
21042104
}
2105+
2106+
/**
2107+
* Execute an asset request which does not need HMAC validation
2108+
* @param url The URL for the asset request
2109+
* @returns {Promise<any>} The response body
2110+
*/
2111+
protected async executeAssetRequest(url: string): Promise<any> {
2112+
const req = this.getAgentRequest('get', url);
2113+
req.set('BitGo-SDK-Version', this._version);
2114+
if (this._customProxyAgent) {
2115+
req.agent(this._customProxyAgent);
2116+
}
2117+
// Set the request timeout to just above 5 minutes by default
2118+
req.timeout((process.env.BITGO_TIMEOUT as any) * 1000 || 305 * 1000);
2119+
if (this.getAdditionalHeadersCb) {
2120+
const additionalHeaders = this.getAdditionalHeadersCb('get', url);
2121+
for (const { key, value } of additionalHeaders) {
2122+
req.set(key, value);
2123+
}
2124+
}
2125+
const result = await req;
2126+
return result.body;
2127+
}
21052128
}

0 commit comments

Comments
 (0)