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

Fix Json Errors #133

Closed
wants to merge 1 commit into from
Closed

Fix Json Errors #133

wants to merge 1 commit into from

Conversation

tomirons
Copy link

Fixes #132

@@ -113,7 +113,7 @@ private function throwIfJsonError(ResponseInterface $response, string|ResponseIn
return;
}

if ($response->getheader('Content-Type')[0] !== 'application/json; charset=utf-8') {
if (! in_array($response->getheader('Content-Type')[0], ['application/json', 'application/json; charset=utf-8'])) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A simpler fix would be to do this. But I'm uncertain if there consequences.

Suggested change
if (! in_array($response->getheader('Content-Type')[0], ['application/json', 'application/json; charset=utf-8'])) {
if ($response->getheader('Content-Type')[0] !== 'application/json') {

@gehrisandro
Copy link
Collaborator

closed in favour of #134

@gehrisandro gehrisandro closed this Jun 1, 2023
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

Successfully merging this pull request may close these issues.

ErrorException: Undefined array key "choices"
2 participants