Skip to content

[PHP] issue with null response #7137

@fMads

Description

@fMads
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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions