swagger-codegen-generators
swagger-codegen-generators copied to clipboard
php/api.mustache: Fix missing body decoding before deserialization
Fixes an issue where the response body was not decoded before attempting to deserialize it into a model when an exception (non-2xx HTTP response) occurs.
Previously, the raw response body stream was passed directly to the deserializer inside the ApiException handling block, which caused deserialization to fail for structured response types (e.g. JSON).
This patch ensures that the body content is read and decoded (JSON-decoded if applicable) before passing it to ObjectSerializer::deserialize(), mirroring the successful response handling logic.