Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support to HTTP Response Header "Location" #4

Closed
jiwhiz opened this issue May 11, 2014 · 3 comments
Closed

Add Support to HTTP Response Header "Location" #4

jiwhiz opened this issue May 11, 2014 · 3 comments

Comments

@jiwhiz
Copy link
Contributor

jiwhiz commented May 11, 2014

In current angular-hal.js code (version 0.1.3) line 219, it only handle HTTP Response Header "Content-Location". It is better to add support to "Location" as well.

There are differences between "Content-Location" and "Location" header, see the blog http://www.subbu.org/blog/2008/10/location-vs-content-location.

"The Location response-header field is used to redirect the recipient to a Location other than the Request-URI for completion of the request or identification of a new resource."

So when the client 'POST' a new resource to the server, the server will return empty response body with "Location" header pointing to the URI of new resource.

I suggest to add one line of code at line 220:

if (res.headers('Location')) return res.headers('Location');

Thanks,

Yuan

@elmerbulthuis
Copy link
Member

I guess this would be a good idea. Could you make a pull-request?

@jiwhiz
Copy link
Contributor Author

jiwhiz commented May 24, 2014

See issue #5 PR.

I also wrote a blog about Angular-HAL:
https://www.jiwhiz.com/post/2014/4/Consume_RESTful_API_With_Angular_HAL

@elmerbulthuis
Copy link
Member

+1 :-) \o/
That is very cool thank you!!! I have put a link in the readme to your post!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants