mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-21 15:33:11 +01:00
bugfix/useragent-header (#2979)
* add bruno-specific userAgent header * Update axios-instance.js --------- Co-authored-by: Linhart Lukáš <Lukas.Linhart@tescosw.cz> Co-authored-by: Anoop M D <anoop.md1421@gmail.com>
This commit is contained in:
parent
e680d0d71d
commit
b3c72b1640
@ -1,4 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const { CLI_VERSION } = require('../constants');
|
||||
|
||||
/**
|
||||
* Function that configures axios with timing interceptors
|
||||
@ -12,6 +13,7 @@ function makeAxiosInstance() {
|
||||
|
||||
instance.interceptors.request.use((config) => {
|
||||
config.headers['request-start-time'] = Date.now();
|
||||
config.headers['user-agent'] = `bruno-runtime/${CLI_VERSION}`;
|
||||
return config;
|
||||
});
|
||||
|
||||
|
@ -2,6 +2,7 @@ const URL = require('url');
|
||||
const Socket = require('net').Socket;
|
||||
const axios = require('axios');
|
||||
const connectionCache = new Map(); // Cache to store checkConnection() results
|
||||
const electronApp = require("electron");
|
||||
|
||||
const LOCAL_IPV6 = '::1';
|
||||
const LOCAL_IPV4 = '127.0.0.1';
|
||||
@ -65,6 +66,7 @@ function makeAxiosInstance() {
|
||||
},
|
||||
proxy: false
|
||||
});
|
||||
const version = electronApp?.app?.getVersion()?.substring(1) ?? "";
|
||||
|
||||
instance.interceptors.request.use(async (config) => {
|
||||
const url = URL.parse(config.url);
|
||||
@ -84,6 +86,7 @@ function makeAxiosInstance() {
|
||||
}
|
||||
|
||||
config.headers['request-start-time'] = Date.now();
|
||||
config.headers['user-agent'] = `bruno-runtime/${version}`;
|
||||
return config;
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user