feat: bruno cli awsv4 auth support

This commit is contained in:
Anoop M D
2024-02-23 23:42:28 +05:30
parent 5fece08f4b
commit 43c873422f
7 changed files with 231 additions and 4 deletions

View File

@@ -15,6 +15,7 @@ const https = require('https');
const { HttpProxyAgent } = require('http-proxy-agent');
const { SocksProxyAgent } = require('socks-proxy-agent');
const { makeAxiosInstance } = require('../utils/axios-instance');
const { addAwsV4Interceptor, resolveAwsV4Credentials } = require('./awsv4auth-helper');
const { shouldUseProxy, PatchedHttpsProxyAgent } = require('../utils/proxy-util');
const protocolRegex = /^([-+\w]{1,25})(:?\/\/|:)/;
@@ -190,6 +191,12 @@ const runSingleRequest = async function (
// run request
const axiosInstance = makeAxiosInstance();
if (request.awsv4config) {
request.awsv4config = await resolveAwsV4Credentials(request);
addAwsV4Interceptor(axiosInstance, request);
delete request.awsv4config;
}
/** @type {import('axios').AxiosResponse} */
response = await axiosInstance(request);