Skip to content

Commit ffb74bc

Browse files
authored
[OGUI-1634] Add path explicitly to HEAD response from CCDB (#2801)
* on the HEAD response from CCDB, we explicitly add the path. This is needed because depending on the CCDB mode of operation (memory or local), the path may not be part of the response
1 parent 37a4a00 commit ffb74bc

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

QualityControl/lib/services/ccdb/CcdbService.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,11 @@ export class CcdbService {
206206
if (!location) {
207207
throw new Error(`No location provided by CCDB for object with path: ${path}`);
208208
}
209-
headers.location = location;
210-
return headers;
209+
return {
210+
...headers,
211+
location,
212+
path,
213+
};
211214
} else {
212215
throw new Error(`Unable to retrieve object: ${path} due to status: ${status}`);
213216
}

QualityControl/test/lib/services/CcdbService.test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,15 @@ export const ccdbServiceTestSuite = async () => {
251251
await rejects(async () => ccdb.getObjectDetails({ path: null, validFrom: 213 }, null), new Error('Missing mandatory parameters: path & validFrom'));
252252
});
253253

254-
test('should successfully return content-location field on status >=200 <= 399', async () => {
254+
test('should successfully return content-location field on status >=200 <= 399 and add path if missing', async () => {
255+
const path = 'qc/some/test/';
255256
nock('http://ccdb-local:8083')
256257
.defaultReplyHeaders({ 'content-location': '/download/123123-123123', location: '/download/some-id' })
257-
.head('/qc/some/test/123455432/id1')
258+
.head(`/${path}/123455432/id1`)
258259
.reply(303);
259-
const content = await ccdb.getObjectDetails({ path: 'qc/some/test', validFrom: 123455432, id: 'id1' });
260+
const content = await ccdb.getObjectDetails({ path, validFrom: 123455432, id: 'id1' });
260261
strictEqual(content.location, '/download/123123-123123');
262+
strictEqual(content.path, path);
261263
});
262264

263265
test('should successfully return content-location field if is string as array with "alien" second item on status >=200 <= 399', async () => {

0 commit comments

Comments
 (0)