Fix missing user-agent headers

This commit is contained in:
Yarmo Mackenbach 2022-11-30 22:29:54 +01:00
parent bfc64ce898
commit 1720c59093
No known key found for this signature in database
GPG key ID: 37367F4AF4087AD1
4 changed files with 9 additions and 2 deletions

View file

@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased] ## [Unreleased]
### Fixed
- Added missing user-agent headers
## [0.18.0] - 2022-11-17 ## [0.18.0] - 2022-11-17
### Changed ### Changed

View file

@ -66,7 +66,8 @@ module.exports.fn = async (data, opts) => {
const headers = { const headers = {
host, host,
date: now.toUTCString(), date: now.toUTCString(),
accept: 'application/activity+json' accept: 'application/activity+json',
'User-Agent': `doipjs/${require('../../package.json').version}`
} }
if (isConfigured && jsEnv.isNode) { if (isConfigured && jsEnv.isNode) {

View file

@ -58,7 +58,10 @@ module.exports.fn = async (data, opts) => {
const url = `https://${opts.claims.matrix.instance}/_matrix/client/r0/rooms/${data.roomId}/event/${data.eventId}?access_token=${opts.claims.matrix.accessToken}` const url = `https://${opts.claims.matrix.instance}/_matrix/client/r0/rooms/${data.roomId}/event/${data.eventId}?access_token=${opts.claims.matrix.accessToken}`
axios.get(url, axios.get(url,
{ {
headers: { Accept: 'application/json' } headers: {
Accept: 'application/json',
'User-Agent': `doipjs/${require('../../package.json').version}`
}
}) })
.then(res => { .then(res => {
return res.data return res.data

View file

@ -59,6 +59,7 @@ module.exports.fn = async (data, opts) => {
{ {
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
'User-Agent': `doipjs/${require('../../package.json').version}`,
Authorization: `Bearer ${opts.claims.twitter.bearerToken}` Authorization: `Bearer ${opts.claims.twitter.bearerToken}`
} }
} }