Open gregmacbean opened 7 years ago
Are you sure the type of response.data
is even a Resource
? I would expect it to be plain JSON. Because the response type from a POST is pretty much undefined.
Also, when you set the resource type (as you set it to HalResource
in your example), this does not "propagate". I mean that in this example, resource1
is a HalResource
but resource2
is a Resource
.
var resource2 = new ResourceContext().get('http://example.com/resource1').$linkRel('relation1', HalResource).$linkRel('relation2');
If you want every resource in a context to be a HalResource
(except when you override it), create the context resource like this:
var context = new ContextResource(HalResource);
To anwer you questions:
Location
header differently, but that is currently not implemented. Pull requests welcome! :smile: new ResourceContext(HalResource).get(someUrl)
.Does this help?
@cegoya Is this issue still relevant?
I am using angular-hypermedia with HalResources, I have set this as the default for my HalContext.
When I do a post using the following:
The typeof the response.data is a Resource, and not a HalResource as I expected.
Two questions:
Should angular-hypermedia be updated to return a HalResource from a post when this is the expected factory.
I am struggling to create a HalResource from the Resource, there seems to be some unexpected side affects, I keep getting httpPost on context undefined when using:
new halResource(createdClient._links['create-invoice'].href, myContext).$linkRel // (or $post)
The console error is :
The code at location being,
Where to from here?