File tree 2 files changed +5
-0
lines changed
bruno-electron/src/ipc/network
2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change 1
1
const axios = require ( 'axios' ) ;
2
+ const { CLI_VERSION } = require ( '../constants' ) ;
2
3
3
4
/**
4
5
* Function that configures axios with timing interceptors
@@ -12,6 +13,7 @@ function makeAxiosInstance() {
12
13
13
14
instance . interceptors . request . use ( ( config ) => {
14
15
config . headers [ 'request-start-time' ] = Date . now ( ) ;
16
+ config . headers [ 'user-agent' ] = `bruno-runtime/${ CLI_VERSION } ` ;
15
17
return config ;
16
18
} ) ;
17
19
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ const URL = require('url');
2
2
const Socket = require ( 'net' ) . Socket ;
3
3
const axios = require ( 'axios' ) ;
4
4
const connectionCache = new Map ( ) ; // Cache to store checkConnection() results
5
+ const electronApp = require ( "electron" ) ;
5
6
6
7
const LOCAL_IPV6 = '::1' ;
7
8
const LOCAL_IPV4 = '127.0.0.1' ;
@@ -65,6 +66,7 @@ function makeAxiosInstance() {
65
66
} ,
66
67
proxy : false
67
68
} ) ;
69
+ const version = electronApp ?. app ?. getVersion ( ) ?. substring ( 1 ) ?? "" ;
68
70
69
71
instance . interceptors . request . use ( async ( config ) => {
70
72
const url = URL . parse ( config . url ) ;
@@ -84,6 +86,7 @@ function makeAxiosInstance() {
84
86
}
85
87
86
88
config . headers [ 'request-start-time' ] = Date . now ( ) ;
89
+ config . headers [ 'user-agent' ] = `bruno-runtime/${ version } ` ;
87
90
return config ;
88
91
} ) ;
89
92
You can’t perform that action at this time.
0 commit comments