Skip to content

Commit af4944d

Browse files
authored
Merge pull request #44 from marcialfps/patch-1
Fixed bug with empty headers
2 parents 0d23453 + 9a4c13b commit af4944d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/src/response/service/hal-response-service.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ export function getType({ headers } = {}) {
1212
}
1313

1414
export function containsHalResource({ headers } = {}) {
15-
return (headers[CONTENT_TYPE].includes(HAL_JSON) || headers[CONTENT_TYPE].includes(HAL_JSON2))
16-
? true
17-
: headers[CONTENT_LOCATION] && headers[LOCATION] && headers[CONTENT_LOCATION] === headers[LOCATION];
15+
return headers && headers[CONTENT_TYPE] ?
16+
(headers[CONTENT_TYPE].includes(HAL_JSON) || headers[CONTENT_TYPE].includes(HAL_JSON2)) ?
17+
true
18+
: headers[CONTENT_LOCATION] && headers[LOCATION] && headers[CONTENT_LOCATION] === headers[LOCATION]
19+
: false;
1820
}

0 commit comments

Comments
 (0)