Skip to content
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

Content class does not handle charset extensions. #45

Closed
Beanow opened this issue Oct 30, 2014 · 4 comments
Closed

Content class does not handle charset extensions. #45

Beanow opened this issue Oct 30, 2014 · 4 comments

Comments

@Beanow
Copy link

Beanow commented Oct 30, 2014

Aura\Web\Request\Content has a type property directly from $_SERVER['CONTENT_TYPE'].
In my requests however these look like: application/json; charset=utf-8.

The content does not get parsed with the built in decoder, because:
"application/json" != "application/json; charset=utf-8".

    protected $decoders = array(
        'application/json' => 'json_decode',
        'application/x-www-form-urlencoded' => 'parse_str',
    );

Perhaps the content class should split the content type over two properties, type and charset.

@harikt
Copy link
Member

harikt commented Oct 30, 2014

May be use Aura.Accept which is split from Aura.Web v2 ?

@Beanow
Copy link
Author

Beanow commented Oct 30, 2014

For my application I can. But currently this looks like a bug.
If I send a PUT request with application/json; charset=utf-8, then use $content->get() it will return the JSON data as a string, while I would expect the decoder to work.

@pmjones
Copy link
Member

pmjones commented Oct 31, 2014

Thanks for the report @Beanow -- let me know if that commit takes care of it for you!

@Beanow
Copy link
Author

Beanow commented Oct 31, 2014

At first glance looks good. I'll let you know when I've updated my application to test it.

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

No branches or pull requests

3 participants