Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Add X-Request-ID to headers unconditionally #1016

Merged
merged 1 commit into from
Mar 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ to add the `owncloud-sdk` to your project.
If you haven't done so already, you also need to add the following `peerDependencies` to your dependencies:

```
npm install axios cross-fetch promise qs semver utf8 uuid webdav xml-js
npm install axios cross-fetch promise qs utf8 uuid webdav xml-js
```

or

```
yarn add axios cross-fetch promise qs semver utf8 uuid webdav xml-js
yarn add axios cross-fetch promise qs utf8 uuid webdav xml-js
```

## Usage
Expand Down
6 changes: 6 additions & 0 deletions changelog/unreleased/bugfix-unconditional-request-id
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Always add X-Request-ID

We've removed a version check that omitted the `X-Request-ID` header value in request headers when the backend version was below v10.1.0. Since ownCloud Infinite Scale follows it's own versioning this caused oCIS not having the X-Request-ID in any request if below this version, hence preventing us from announcing the correct version for oCIS.

https://github.com/owncloud/owncloud-sdk/pull/1016
https://github.com/owncloud/ocis/pull/2918
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
"jsdoc": "^3.6.1",
"promise": "^8.0.3",
"qs": "^6.10.3",
"semver": "^7.3.5",
"sync-fetch": "^0.3.0",
"utf8": "^3.0.0",
"uuid": "^8.2.0",
Expand All @@ -109,7 +108,6 @@
"cross-fetch": "^3.0.6",
"promise": "^8.0.3",
"qs": "^6.10.3",
"semver": "^7.3.5",
"utf8": "^3.0.0",
"uuid": "^8.2.0",
"webdav": "4.8.0",
Expand Down
12 changes: 1 addition & 11 deletions src/helperFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,20 +195,10 @@ class helpers {
if (withAuthHeader) {
headers.Authorization = this._authHeader
}
if (this.atLeastVersion('10.1.0')) {
headers['X-Request-ID'] = uuidv4()
}
headers['X-Request-ID'] = uuidv4()
return headers
}

atLeastVersion (minVersion) {
if (this._versionNumber === null) {
return false
}
const semver = require('semver')
return semver.gte(this._versionNumber, minVersion)
}

/**
* Makes an OCS API request.
* @param {string} method method of request (GET, POST etc.)
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7546,7 +7546,7 @@ semver@^6.0.0, semver@^6.1.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0:
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d"
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==

semver@^7.2.1, semver@^7.3.2, semver@^7.3.5:
semver@^7.2.1, semver@^7.3.2:
version "7.3.5"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7"
integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==
Expand Down