mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
use proper correlation id
This commit is contained in:
parent
977da80885
commit
bb692f4bc9
4 changed files with 30 additions and 8 deletions
|
@ -1,6 +1,8 @@
|
||||||
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
|
||||||
const getHeaders = (contentType) => {
|
const getHeaders = (contentType) => {
|
||||||
return {
|
return {
|
||||||
'X-Correlation-ID': 'null',
|
'X-Correlation-ID': uuidv4()+'_'+uuidv4(),
|
||||||
'Accept': contentType,
|
'Accept': contentType,
|
||||||
'Content-Type': contentType,
|
'Content-Type': contentType,
|
||||||
};
|
};
|
||||||
|
|
25
package-lock.json
generated
25
package-lock.json
generated
|
@ -18,7 +18,8 @@
|
||||||
"lodash": "^4.17.5",
|
"lodash": "^4.17.5",
|
||||||
"luxon": "^3.1.1",
|
"luxon": "^3.1.1",
|
||||||
"qs": "^6.6.0",
|
"qs": "^6.6.0",
|
||||||
"slugg": "^1.2.0"
|
"slugg": "^1.2.0",
|
||||||
|
"uuid": "^11.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@pollyjs/adapter-node-http": "^6.0.5",
|
"@pollyjs/adapter-node-http": "^6.0.5",
|
||||||
|
@ -1272,6 +1273,15 @@
|
||||||
"node": ">=16.17"
|
"node": ">=16.17"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@tapjs/processinfo/node_modules/uuid": {
|
||||||
|
"version": "8.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||||
|
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"uuid": "dist/bin/uuid"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@tapjs/reporter": {
|
"node_modules/@tapjs/reporter": {
|
||||||
"version": "2.0.8",
|
"version": "2.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@tapjs/reporter/-/reporter-2.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/@tapjs/reporter/-/reporter-2.0.8.tgz",
|
||||||
|
@ -7931,12 +7941,15 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/uuid": {
|
"node_modules/uuid": {
|
||||||
"version": "8.3.2",
|
"version": "11.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-11.0.5.tgz",
|
||||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
"integrity": "sha512-508e6IcKLrhxKdBbcA2b4KQZlLVp2+J5UwQ6F7Drckkc5N9ZJwFa4TgWtsww9UG8fGHbm6gbV19TdM5pQ4GaIA==",
|
||||||
"dev": true,
|
"funding": [
|
||||||
|
"https://github.com/sponsors/broofa",
|
||||||
|
"https://github.com/sponsors/ctavan"
|
||||||
|
],
|
||||||
"bin": {
|
"bin": {
|
||||||
"uuid": "dist/bin/uuid"
|
"uuid": "dist/esm/bin/uuid"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/v8-compile-cache-lib": {
|
"node_modules/v8-compile-cache-lib": {
|
||||||
|
|
|
@ -65,7 +65,8 @@
|
||||||
"lodash": "^4.17.5",
|
"lodash": "^4.17.5",
|
||||||
"luxon": "^3.1.1",
|
"luxon": "^3.1.1",
|
||||||
"qs": "^6.6.0",
|
"qs": "^6.6.0",
|
||||||
"slugg": "^1.2.0"
|
"slugg": "^1.2.0",
|
||||||
|
"uuid": "^11.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@pollyjs/adapter-node-http": "^6.0.5",
|
"@pollyjs/adapter-node-http": "^6.0.5",
|
||||||
|
|
|
@ -126,6 +126,12 @@ if (process.env.VCR_MODE && !process.env.VCR_OFF) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
// using exclude above would still require re-recording everything...
|
||||||
|
polly.server.any().on('request', req => {
|
||||||
|
if (req.hasHeader('X-Correlation-ID')) {
|
||||||
|
req.setHeader('X-Correlation-ID', ['null']);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
tap.teardown(async () => {
|
tap.teardown(async () => {
|
||||||
await polly.stop();
|
await polly.stop();
|
||||||
|
|
Loading…
Add table
Reference in a new issue