JSon response not detected with header containing utf8#39
JSon response not detected with header containing utf8#39JLTRY wants to merge 4 commits intojoomla-framework:4.x-devfrom
Conversation
3ec4d82 to
46dbf71
Compare
case of header =
Array
(
[0] => application/json; charset=utf-8
)
correct phpstan
|
@rdeutz @richard67 @LadySolveig I need this pull request to be able to run correctly my google auth extension |
|
Somethings are wrong here. getHeader() is case insensitive, so the loop is not needed, also strpos is pre php 8.0, use str_starts_with instead. my suggestion: if (in_array('application/json', $response->getHeader('Content-Type'))) {to if (str_starts_with('application/json', strtolower($response->getHeader('Content-Type')[0]))) {but that's not really correct, you should iterate over the |
do not use strpos use str_starts_with instead. getHeader() is case insensitive
|
@HLeithner I modified the code following your directives |
|
@HLeithner Can you lease review the code . I tested it OK with my component + with Strava authentification |
case of header =
Array
(
[0] => application/json; charset=utf-8
)
correct phpstan
Pull Request for Issue #19
Summary of Changes
accept application/json; charset=utf-8 in header
Testing Instructions
checked with extension for Google authentification
https://extensions.joomla.org/extension/access-a-security/jo-s-google-auth/
Documentation Changes Required
no