swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

[PHP] issue with null response

Open fMads opened this issue 8 years ago • 0 comments

Description

When calling and endpoint, and it doesn't respond within the timeout set for guzzle, a PHP Error will be thrown. It happens because when cathing RequestException, it is not check if Response is set before trying to call getBody() on it.

Error message: Call to a member function getBody() on null

Swagger-codegen version

2.3.0-SNAPSHOT (from docker image)

Steps to reproduce

Call and endpoint and let it time out (by controlling GuzzleRequestOptions::timeout http://docs.guzzlephp.org/en/stable/request-options.html#timeout). Fx set timeout to 0.1 sec.

Suggest a fix/enhancement

Check that Response is not NULL, before calling getBody() on it

fMads avatar Dec 08 '17 13:12 fMads