You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Body data returned from calling API using curlrequest become unreadable when the returned data is long. I can get normal json data from calling the same API if I'm using native php curl function. When the returned data is short, curlrequest will return normal json.
Sample code using curlrequest :
When sending data using curlrequest the returned body become something like this : �����[�#�u���+�~��E4��-bC�m�Ύb�{f�ýX��jtM7�������c#�6E��C�#,J�dY�D��LQaK�Z���'�\VO��>U�K^Nf%*�v� 2��3���dV� ���N�~���YΖ���h��.w������ ��hv9�D���"�W�e۟��8Zo^F��+���m4n��'�N�5�s{���Ɏ���I�8ݴs���u4����n�&|�ݧ������~��������o씍��(i1?��/>YM&��ٖ���"Z4'��E��nq;����2��}N�2��F�x5�1�4����I$�W�͇���}�/F%���������*|�~vrw���|
Apparently the problem was caused by the curl on vendor\codeigniter4\framework\system\HTTP\CURLRequest.php having Accept-Encoding: gzip, deflate, br on the CURLOPT_HTTPHEADER. Removing Accept-Encoding from header or adding CURLOPT_ENCODING with empty value to $curl_options will solve the problem with long json data
Describe the bug
Body data returned from calling API using curlrequest become unreadable when the returned data is long. I can get normal json data from calling the same API if I'm using native php curl function. When the returned data is short, curlrequest will return normal json.
Sample code using curlrequest :
` $client = \Config\Services::curlrequest();
`
Sample code using php curl :
`$curl = curl_init();
When sending data using curlrequest the returned body become something like this :
�����[�#�u���+�~��E4��-bC�m�Ύb�{f�ýX��jtM7�������c#�6E��C�#,J�dY�D��LQaK�Z���'�\VO��>U�K^Nf%*�v� 2��3���dV� ���N�~���YΖ���h��.w������ ��hv9�D���"�W�e۟��8Zo^F��+���m4n��'�N�5�s{���Ɏ���I�8ݴs���u4����n�&|�ݧ������~��������o씍��(i1?��/>YM&��ٖ���"Z4'��E��nq;����2��}N�2��F�x5�1�4����I$�W�͇���}�/F%���������*|�~vrw���|
CodeIgniter 4 version
v4.0.3
Affected module(s)
\Config\Services::curlrequest();
Expected behavior, and steps to reproduce if appropriate
Expected to get json data even when API return long data
Context
The text was updated successfully, but these errors were encountered: