[openstack-dev] [nova] Trailing Slashes on URLs

Shoham Peller shoham.peller at stratoscale.com
Tue Mar 22 20:44:04 UTC 2016


Thank you for your answer Sean. Well understood.
However, I think that if not fix this issue, at least we should supply
guidelines on the matter.

For example tempest's "test_delete_security_group_without_passing_id" test
actually checks this behavior by addressing a security group with an "empty
id" (/v2.1/{tenant_id}/os-security-groups/), and expects nova to return
404. The comment on the code says:
# Negative test:Deletion of a Security Group with out passing ID should
Fail

If we'll release guidelines on the matter, and the right way to use the
API, and that the trailing slashes issue is just a known bug as you say,
this test is rendered useless.

What do you think?

On Tue, Mar 22, 2016 at 7:37 PM, Sean Dague <sean at dague.net> wrote:
>
> On 03/22/2016 12:34 PM, Shoham Peller wrote:
> > Hi,
> >
> > Nova-api behaves different whether a trailing-slash is given in the URL
> > or not.
> > These 2 requests produce different results:
> >
> >   * GET /v2/{tenant-id}/servers - gets a list of servers
> >   * GET /v2/{tenant-id}/servers/ - gets an info for a server with an
> >     "empty id" - produces 404
> >
> > IMHO, a trailing slash in REST requests should be ignored.
> >
> > A few resources about REST and trailing slashes:
> >
http://programmers.stackexchange.com/questions/186959/trailing-slash-in-restful-api
> > https://github.com/nicolaiarocci/eve/issues/118
> >
> > What do you think of this issue?
> > Is this difference in behavior is on purpose?
>
> This is the way python routes works, it's pretty embedded behavior in
> libraries we don't control.
>
> While one could argue they should be equivalent, the docs are pretty
> straight forward about what the correct links are, and we only generate
> working links in our references.
>
> There are many issues that we should address in the API, this one
> probably doesn't crack the top 100.
>
>         -Sean
>
> --
> Sean Dague
> http://dague.net
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20160322/0b42efbb/attachment.html>


More information about the OpenStack-dev mailing list