Skip to content

Commit 0c98fcf

Browse files
own review changes
1 parent 8150c9c commit 0c98fcf

File tree

6 files changed

+4
-19
lines changed

6 files changed

+4
-19
lines changed

sandbox/controllers/Controller.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ class Controller {
1313
*/
1414
Object.entries(payload.headers).forEach(([name, value]) => response.setHeader(name, String(value)));
1515
response.status(payload.code || 200);
16-
1716
const responsePayload = payload.payload !== undefined ? payload.payload : payload;
1817
if (responsePayload instanceof Object) {
1918
response.json(responsePayload);
@@ -107,7 +106,6 @@ class Controller {
107106

108107
static async handleRequest(request, response, serviceOperation) {
109108
try {
110-
const requestParams = this.collectRequestParams(request);
111109
const serviceResponse = await serviceOperation(requestParams);
112110
Controller.sendResponse(response, serviceResponse);
113111
} catch (error) {

sandbox/utils/ResponseProvider.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,7 @@ const futil = require('fs');
66
// eslint-disable-next-line import/no-extraneous-dependencies
77
const lodash = require('lodash');
88

9-
function mapExampleResponse1(requestBody, exampleResponseMap) {
10-
const match = Object.entries(exampleResponseMap).find(async ([requestBodyPath, response]) => {
11-
try {
12-
const requestBodyContent = await fs.readFile(requestBodyPath, 'utf8');
13-
const exampleRequestBody = JSON.parse(requestBodyContent);
14-
return lodash.isEqual(requestBody, exampleRequestBody);
15-
} catch (err) {
16-
console.error(`Failed to process ${requestBodyPath}:`, err);
17-
throw err;
18-
}
19-
});
209

21-
return match ? match[1] : null; // Return the matched response, or undefined if no match
22-
}
2310
async function mapExampleResponse(requestBody, exampleResponseMap) {
2411

2512
const entries = Object.entries(exampleResponseMap);

specification/api/components/responses/getLetter200.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ content:
66
examples:
77
get-letters:
88
value:
9-
$ref: ../examples/getLetter/responses/getLetter.json
9+
$ref: ../examples/getLetter/responses/getLetter-24L5eYSWGzCHlGmzNxuqVusPxDg.json

specification/api/components/responses/getLetters200.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ content:
66
examples:
77
get-letters:
88
value:
9-
$ref: ../examples/getLetters/responses/getLetters.json
9+
$ref: ../examples/getLetters/responses/getLetters_pending.json

specification/api/components/responses/patchLetter200.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ content:
66
examples:
77
patch_letter-response:
88
value:
9-
$ref: ../examples/patchLetter/responses/patchLetter.json
9+
$ref: ../examples/patchLetter/responses/patchLetter_ACCEPTED.json

specification/api/components/responses/postMI201.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ content:
66
examples:
77
create-mi-response:
88
value:
9-
$ref: "../examples/createMI/responses/createMIResponse.json"
9+
$ref: "../examples/createMI/responses/createMI_SUCCESS.json"

0 commit comments

Comments
 (0)