yiisoft/yii2-httpclient

Method detectFormatByContent don't detect JSON Array

germanow opened this issue · 0 comments

What steps will reproduce the problem?

Send a request to a JSON API.
Get response where not set Content-Type header with following data:

[{"name1":"value1", "name2":"value2"},{"name1":"value3", "name2":"value4"}]

What's expected?

Method return Client::FORMAT_JSON

What do you get instead?

Methor return null.

Additional info

Q A
Yii version 2.0.15.1
Yii HTTP Client version 2.0.6
PHP version 7.1.20-1+ubuntu18.04.1+deb.sury.org+1
Operating system Linux Mint 19 Tara