Automatically decode response based on the content-type header
Closed this issue · 1 comments
nealio82 commented
Because this is better than using string functions to work out the response format
nealio82 commented
Also, when response is in CSV format, there is a bug causing exceptions when the default response decoder is used
Notice: Undefined offset: 2
500 Internal Server Error - ContextErrorException
Stack Trace
in src/Mediamath/src/MediaMath/TerminalOneAPI/Decoder/DefaultResponseDecoder.php at line 45 -
preg_match('/("meta"\ ?\:\ ?)(\{(.)+?\})/s', $api_response, $meta);
$meta = new ApiResponseMeta(json_decode($meta[2], true));
return new ApiResponse($meta, $api_response);