Skip to content

[9.0] [Console] Fix output when HTTP request to server fails (#219073)#219439

Merged
ElenaStoeva merged 1 commit intoelastic:9.0from
ElenaStoeva:backport/9.0/pr-219073
Apr 30, 2025
Merged

[9.0] [Console] Fix output when HTTP request to server fails (#219073)#219439
ElenaStoeva merged 1 commit intoelastic:9.0from
ElenaStoeva:backport/9.0/pr-219073

Conversation

@ElenaStoeva
Copy link
Contributor

Backport

This will backport the following commits from main to 9.0:

Questions ?

Please refer to the Backport tool documentation

Follow-up to
elastic#218104 (comment)

## Summary

This PR fixes the Console output when the HTTP request to the server
fails with a non-empty error body. In
elastic#218104, we incorrectly set the
output to be `Request failed to get to the server (status code: ' +
statusCode + ')` even if there is an error body. In this PR, we make
sure to display the error body if it's non-empty.

**How to test:**

Send a request that fails and verify that the error body is displayed:

```
POST kbn:/api/alerting/rule/3603c386-9102-4c74-800d-2242e52bec98
{
  "name": "Alert on status change",
  "rule_type_id": ".es-querya"
}
```
<img width="1160" alt="Screenshot 2025-04-24 at 14 41 57"
src="https://github.com/user-attachments/assets/ced78171-4924-477f-ba2f-d5812bff1678"
/>

(cherry picked from commit cb0acc1)

# Conflicts:
#	src/platform/plugins/shared/console/public/application/hooks/use_send_current_request/send_request.ts
@ElenaStoeva ElenaStoeva added the backport This PR is a backport of another PR label Apr 28, 2025
@ElenaStoeva ElenaStoeva enabled auto-merge (squash) April 28, 2025 18:33
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #87 / core route timeouts idle socket should timeout if payload sending has too long of an idle period

Metrics [docs]

✅ unchanged

@ElenaStoeva ElenaStoeva merged commit fa3f35b into elastic:9.0 Apr 30, 2025
12 checks passed
@ElenaStoeva ElenaStoeva deleted the backport/9.0/pr-219073 branch January 31, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants