fallback to insomnia user agent (#6429)

* fallback to insomnia user agent

* add default user-agent to oauth2
This commit is contained in:
Jack Kavanagh 2023-08-31 10:29:51 +02:00 committed by GitHub
parent 0ab5809bba
commit 338dfc9a85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ import crypto from 'crypto';
import querystring from 'querystring'; import querystring from 'querystring';
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import { version } from '../../../package.json';
import { escapeRegex } from '../../common/misc'; import { escapeRegex } from '../../common/misc';
import * as models from '../../models'; import * as models from '../../models';
import type { OAuth2Token } from '../../models/o-auth-2-token'; import type { OAuth2Token } from '../../models/o-auth-2-token';
@ -303,6 +304,7 @@ const sendAccessTokenRequest = async (requestId: string, authentication: AuthTyp
headers: [ headers: [
{ name: 'Content-Type', value: 'application/x-www-form-urlencoded' }, { name: 'Content-Type', value: 'application/x-www-form-urlencoded' },
{ name: 'Accept', value: 'application/x-www-form-urlencoded, application/json' }, { name: 'Accept', value: 'application/x-www-form-urlencoded, application/json' },
{ name: 'User-Agent', value: 'insomnia/' + version },
...headers, ...headers,
], ],
url: setDefaultProtocol(authentication.accessTokenUrl), url: setDefaultProtocol(authentication.accessTokenUrl),