Skip to content

Commit f9c7030

Browse files
committed
fix: format
1 parent 225ff8b commit f9c7030

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

tools/spectral/ipa/__tests__/deleteMethod204Response.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ testRule('xgen-IPA-108-delete-method-return-204-response', [
2020
errors: [],
2121
},
2222
{
23-
name: 'valid DELETE with no responses',
23+
name: 'invalid DELETE with no responses',
2424
document: {
2525
paths: {
2626
'/resource/{id}': {

tools/spectral/ipa/rulesets/functions/deleteMethod204Response.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,14 @@ const ERROR_MESSAGE = 'DELETE method should return 204 No Content status code.';
1212
* @param {object} context - The context object containing the path
1313
*/
1414
export default (input, _, { path }) => {
15-
const deleteOp = input;
16-
if (hasException(deleteOp, RULE_NAME)) {
17-
collectException(deleteOp, RULE_NAME, path);
15+
const responses = input.responses;
16+
if (hasException(input, RULE_NAME)) {
17+
collectException(input, RULE_NAME, path);
1818
return;
1919
}
2020

21-
if (deleteOp.responses) {
22-
if (!deleteOp.responses['204']) {
23-
return collectAndReturnViolation(path, RULE_NAME, ERROR_MESSAGE);
24-
}
25-
return collectAdoption(path, RULE_NAME);
21+
if (!responses['204']) {
22+
return collectAndReturnViolation(path, RULE_NAME, ERROR_MESSAGE);
2623
}
24+
return collectAdoption(path, RULE_NAME);
2725
};

0 commit comments

Comments
 (0)