8000 Custom MIME type and versioning cause failures · Issue #1399 · FriendsOfSymfony/FOSRestBundle · GitHub
[go: up one dir, main page]

Skip to content
Custom MIME type and versioning cause failures #1399
@araines

Description

@araines

FOSRestBundle 2.0 Beta 2
Symfony 2.7

I'm trying to implement a custom MIME type on my API, and require all clients to use it. This part appears to work fine until I start to try to add versioning.

config.yml

fos_rest:
    view:
        view_response_listener: force
        mime_types:
            json: ['application/vnd.foo.api+json;version=3']
    versioning:
        enabled: true
        resolvers:
            media_type:
                enabled: true
                regex: '/version=(?P<version>[0-9]+)/'
    format_listener:
        enabled: true
        rules:
            -
                path: '^/bracket/'
                priorities: ['json']
                fallback_format: ~
                prefer_extension: false

When I send a request, I get a HTTP406 (Not Acceptable) response:

curl -H 'Accept: application/vnd.foo.api+json;version=3' http://localhost:8080/bar/20

Individually, both of these features appear to work. For example, if I change my mime type as follows:

        mime_types:
            json: ['application/json;version=3']

And send a request:

curl -H 'Accept: application/json;version=3' http://localhost:8080/bar/20

Then I get the response I expect.

Also if I set it to my custom vendor descriptor:

        mime_types:
            json: ['application/vnd.foo.api+json;version=3']

curl -H 'Accept: application/vnd.foo.api+json' http://localhost:8080/bar/20

This also works (I get a HTTP200 response).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0