Skip to content

Versioning accept header strict/cascade settings appears to not work in this case #1082

Closed
@elliotlarson

Description

@elliotlarson

If I have this config for versioning...

version 'v1', using: :header, vendor: 'acme', strict: true, cascade: false

then this should require that I pass the appropriate Accept request header to get a valid 200 response.

This request should work:

$ curl -H 'Accept:application/vnd.acme-v1+json' http://localhost:3000/api/projects
=> succeeds √ 

... and it does, returning a successful 200 response.

But, not passing the correct Accept header should result in an error. For example, this request:

$ curl -H 'Accept:application/vnd.acme-nonexistentversion+json' http://localhost:3000/api/projects
=> fails √ 

... fails with a 406 response as expected.

However, this request returns a successful 200 API response, which is unexpected:

$ curl -H 'Accept:application/xml' http://localhost:3000/api/projects
=> succeeds ?

I didn't make the request with the correct version Accept header, but I'm getting a successful 200 response. Is this a bug, or have I misunderstood how the strict: true, cascade: false config settings are supposed to work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions