-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(lapis2): bring back request id header in OpenAPI docs
resolves #627
- Loading branch information
1 parent
c5420e8
commit eb75391
Showing
2 changed files
with
33 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,23 @@ | ||
import { expect } from 'chai'; | ||
import { basePath } from './common'; | ||
import { lapisClient } from './common'; | ||
|
||
describe('The request id', () => { | ||
it('should be returned when explicitly specified', async () => { | ||
const requestID = 'hardcodedRequestIdInTheTest'; | ||
|
||
// TODO(#627): bring back the old tests using the generated client | ||
// const result = await lapisClient.postAggregated1({ | ||
// aggregatedPostRequest: {}, | ||
// xRequestID: requestID, | ||
// }); | ||
const result = await fetch(basePath + '/sample/aggregated', { headers: { 'X-Request-Id': requestID } }); | ||
const result = await lapisClient.postAggregated1({ | ||
aggregatedPostRequest: {}, | ||
xRequestID: requestID, | ||
}); | ||
|
||
// expect(result.info.requestId).equals(requestID); | ||
expect((await result.json()).info.requestId).equals(requestID); | ||
expect(result.info.requestId).equals(requestID); | ||
}); | ||
|
||
it('should be generated when none is specified', async () => { | ||
// const result = await lapisClient.postAggregated1({ | ||
// aggregatedPostRequest: {}, | ||
// }); | ||
const result = await fetch(basePath + '/sample/aggregated'); | ||
const result = await lapisClient.postAggregated1({ | ||
aggregatedPostRequest: {}, | ||
}); | ||
|
||
// expect(result.info.requestId).length.is.at.least(1); | ||
expect((await result.json()).info.requestId).length.is.at.least(1); | ||
expect(result.info.requestId).length.is.at.least(1); | ||
}); | ||
}); |