Skip to content

Commit 4e671da

Browse files
committed
fix missing User-Agent
1 parent 6993a39 commit 4e671da

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/clients/transporter.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const {fetch} = require('cross-fetch');
44
const {AuthorizationHandler} = require('./authorization-handler');
55
const {CustomEventTarget} = require('./custom-event-target');
66
const {EndpointChecker} = require('./endpoint-checker');
7-
const {assembleUrl} = require('./helpers');
7+
const {assembleUrl, generateUserAgent} = require('./helpers');
88

99
// Default transport config using fetch
1010
const defaultTransportConfig = {
@@ -35,6 +35,7 @@ class Transporter {
3535
this.options.transportConfig ?? defaultTransportConfig;
3636
this.transportFn = transportConfig.transportFn;
3737
this.responseAdapter = transportConfig.responseAdapter;
38+
this.userAgent = this.options.get('userAgent') ?? generateUserAgent();
3839
}
3940

4041
// Transporter methods
@@ -113,7 +114,7 @@ class Transporter {
113114
Authorization: this.authHandler.createAuthorizationHeader(),
114115
'Content-Type': 'application/json',
115116
Accept: 'application/json',
116-
'User-Agent': this.options.get('userAgent'),
117+
'User-Agent': this.userAgent,
117118
...this.options.get('customHeaders'),
118119
};
119120

0 commit comments

Comments
 (0)