gravitee-io / issues

Gravitee.io - API Platform - Issues
64 stars 26 forks source link

Debug Mode - Build Response from event's response object #8185

Open ytvnr opened 2 years ago

ytvnr commented 2 years ago

Describe the bug

describe-the-bug

describe-the-bug

describe-the-bug

describe-the-bug

describe-the-bug

describe-the-bug

describe-the-bug

Debug Mode use an event object to get information from. This objects is composed of:

In Debug Mode, the final response is built from backendResponse, on which each debug step executed on response phase come to replace with new value.

Let's say, your backend answer with a body my-body, and then an AssignContent policy replaces it with new-body, then the response displayed on debug mode is good.

Now, we introduced the [reactive timeout](https://github.com/gravitee-io/issues/issues/7988), if the backend is too slow to answer, the backendResponse will be like:


 { "status": 0, "body": "" } 

But, the TimeoutException will be treated later and processed by a FailureProcessor to return this body:


 { "message": "Request timeout", "http_status_code": 504 } 

Since the Debug Mode do not use response object of the event, we see an empty body instead of the good one.

To Reproduce

to-reproduce

to-reproduce

to-reproduce

to-reproduce

to-reproduce

to-reproduce

to-reproduce

Steps to reproduce the behaviour:

  1. Configure http.requestTimeout on your gateway
  2. Create an API with a backend answering slower that the configured timeout (you can create another API with an API policy for example)
  3. Check that body is empty

Expected behaviour

expected-behaviour

expected-behaviour

expected-behaviour

expected-behaviour

expected-behaviour

expected-behaviour

expected-behaviour

We should see


 { "message": "Request timeout", "http_status_code": 504 } 

Useful information

useful-information

useful-information

useful-information

useful-information

useful-information

useful-information

useful-information

In the description of this issue, I put the response as a JSON object. It's only possible if you send your request with the header Accept with application/json or ****************/****************, otherwise response will be plain text

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 9 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.