[pull] master from apache:master - #638
Merged
Merged
Conversation
…odies
### What is this PR for?
`AppHttpInterceptor.intercept` unwraps every `HttpResponse` as `event.body.body`, assuming the Zeppelin REST envelope (`{status, message, body}`). When `event.body` is `null` — a 204 No Content, or any empty 200 response — evaluating `event.body.body` throws `TypeError: Cannot read properties of null (reading 'body')`, which propagates to every subscriber of that request and turns an otherwise-successful empty response into a failure.
Non-enveloped JSON and `responseType: 'text'` responses were never affected `event.body.body` is `undefined` for them, and `HttpResponse.clone()` keeps the original body when the update body is `undefined`. The defect was specific to the null-body case.
This PR guards the unwrap on `event.body` being a non-null object that actually carries a `body` field; any other response (including null-body) now passes through `event.clone()` unchanged instead of touching `.body` on it.
### What type of PR is it?
Bug Fix
### Todos
* [x] Guard the unwrap so it only runs on a non-null object carrying a `body` field
* [x] Verify enveloped responses still unwrap correctly
* [x] Verify null-body responses pass through without throwing
### What is the Jira issue?
[ZEPPELIN-6522](https://issues.apache.org/jira/browse/ZEPPELIN-6522)
### How should this be tested?
* `cd zeppelin-web-angular && npm run lint`
* Feed the four body shapes (enveloped object, non-enveloped object, text string, null) through `event.clone({ body: event.body.body })` using a real `<at>angular/common/http` `HttpResponse`: before the fix, only the null case throws `TypeError: Cannot read properties of null (reading 'body')`; after the fix, all four pass through without throwing and the enveloped case still unwraps correctly.
### Questions:
* Does the license files need to update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No
Closes #5344 from JangAyeon/ZEPPELIN-6522.
Signed-off-by: YONGJAE LEE <dev.yongjaelee@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )