Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Accept headers not satisfied in correct order #31

Closed
Wilt opened this issue Apr 9, 2015 · 2 comments
Closed

Accept headers not satisfied in correct order #31

Wilt opened this issue Apr 9, 2015 · 2 comments

Comments

@Wilt
Copy link
Contributor

Wilt commented Apr 9, 2015

According to the WC3 Specifictations the Server should try to satisfy accept headers in order. Currently the order of the content-types in the Accept header is not respected.

So when I send a request with an Accept header like this: application/xml, application/json it should first try to return a xml and then a json model. When I do application/json, application/xml it should be the other way around.

With a config like this:

    'zf-content-negotiation' => array(
        'controllers' => array(
            'My\Controller\Resource' => 'XML/HalJson'
        ),
        'selectors' => array(
            'XML/HalJson' => array(
                'My\View\XmlModel' => array(
                    'application/xml'
                ),
                'ZF\ContentNegotiation\JsonModel' => array(
                    'application/json',
                    'application/*+json',
                ),
            )
        )
    )

The order of the Accept content-types seems to not be respected by the server. In both cases the same model is set.

@weierophinney
Copy link
Member

Please report this upstream to https://github.com/zendframework/zend-mvc, as the logic by which Accept matching occurs is in the AcceptableViewModelSelector controller plugin.

@Wilt
Copy link
Contributor Author

Wilt commented Jul 28, 2015

I reported it here

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

No branches or pull requests

2 participants