You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When trying to parse a Resource returned from a remote API with null embedded resources, halfred reports an error: TypeError: "embeddedElement is null"
It looks like the problem could be solved by adding an if statement in line 73 of parser.js. I can send the PR if needed.
I understand that having a null value for an embedded resource could not be the best option for a HAL API, but I couldn't find any good argument against having null values. (for example, some uninitialized embed that will be populated later).
To Reproduce
Just parsing a Resource with null values will raise the Error:
{
"_embedded": {
"embed": null
}
}
Expected behavior
The parsing process should accomplish without errors.
When querying for the value of "embed", it should return null.
Node.js (please complete the following information):
OS: Ubuntu 18
Node.js version: 10.14.1
Halfred Version: 1.1.0
The text was updated successfully, but these errors were encountered:
This is actually creating quite a blocker for me. I'm trying to follow() links and embeds in the Vimeo api using Traverson-hal, but some items contain the specified element, and some don't, so once it finds a null one, it errors out and doesn't parse the api. Help!
Describe the bug
When trying to parse a Resource returned from a remote API with null embedded resources, halfred reports an error:
TypeError: "embeddedElement is null"
It looks like the problem could be solved by adding an if statement in line 73 of
parser.js
. I can send the PR if needed.I understand that having a null value for an embedded resource could not be the best option for a HAL API, but I couldn't find any good argument against having null values. (for example, some uninitialized embed that will be populated later).
To Reproduce
Just parsing a Resource with null values will raise the Error:
Expected behavior
The parsing process should accomplish without errors.
When querying for the value of "embed", it should return null.
Node.js (please complete the following information):
The text was updated successfully, but these errors were encountered: