Skip to content

Commit

Permalink
Add application/hal+json as valid content type
Browse files Browse the repository at this point in the history
  • Loading branch information
jsardid authored Oct 6, 2020
1 parent 7a2986a commit b7c5dcf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/src/response/service/hal-response-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ const LOCATION = "location";

// Media Types
const HAL_JSON = "application/vnd.hal+json";
const HAL_JSON2 = "application/hal+json";

export function getType({ headers } = {}) {
return headers[CONTENT_TYPE] ? headers[CONTENT_TYPE] : null;
}

export function containsHalResource({ headers } = {}) {
return headers[CONTENT_TYPE].includes(HAL_JSON)
return (headers[CONTENT_TYPE].includes(HAL_JSON) || headers[CONTENT_TYPE].includes(HAL_JSON2))
? true
: headers[CONTENT_LOCATION] && headers[LOCATION] && headers[CONTENT_LOCATION] === headers[LOCATION];
}

0 comments on commit b7c5dcf

Please sign in to comment.