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
Ending URL endpoints with '/' when request doesn't have an id #60
Comments
I actually have no idea about the standard, and assume that some implementations ignore it or support both formats (with / without trailing backslash). Did you try the v0.10 branch? It uses Superagent under the hood to make the HTTP calls, and has pre/post request hooks that allow you to modify things (incl. the end-point). I would go with either v0.10 (which will soon become the official version), or try to modify the API server to accept both. |
Yeah, I think implementations may support different formats. I tried it using the v0.10 branch, with a before hook to this function
But this still sends to the endpoint without the trailing backslash. Any idea? Thanks for the support! |
@lghamie yes - read the docs carefully - If you need to modify the endpoint, you actually have to define your own before hooks, without using the default ones. This is due to an annoyance with Superagent, that requires defining the HTTP end-point first so it can be modified. You can try and do something like that:
Does that make sense? |
@zohararad Many thanks in advance. |
@frontendgineer take a look at the code and the example above. My suggesting is to run sails-rest with a debugger a couple of times so you can see the flow of before and after hooks, and then you can modify at will. If you need more help, post an example of your code and desired endpoint and i'll see if I can provide a more concrete example |
Playing with some API i'm triyng to integrate I get some errors that are related to not having a backslash at the end of the URL when POSTing a new object, (without an id).
Reading here at wikipedia I found that this is no standard, but probably looks as the most accepted way of doing this.
So, specifically this function,
I think it should be something like this:
Note that last forward slash added.
If this is not the way I should do this, because i misunderstood something, please could you oint me in the right direction?
Thanks!
The text was updated successfully, but these errors were encountered: