fix: Allow to set custom user agent (#3146)

Co-authored-by: Linhart Lukáš <Lukas.Linhart@tescosw.cz>
This commit is contained in:
Lukáš Linhart
2024-09-20 10:39:11 +02:00
committed by GitHub
parent 89c8956523
commit dd2b93e8cd
2 changed files with 10 additions and 5 deletions

View File

@@ -9,11 +9,14 @@ const { CLI_VERSION } = require('../constants');
*/
function makeAxiosInstance() {
/** @type {axios.AxiosInstance} */
const instance = axios.create();
const instance = axios.create({
headers: {
"User-Agent": `bruno-runtime/${CLI_VERSION}`
}
});
instance.interceptors.request.use((config) => {
config.headers['request-start-time'] = Date.now();
config.headers['user-agent'] = `bruno-runtime/${CLI_VERSION}`;
return config;
});