Ensure yarn test:rest reads all JSON data, not just first chunk#1820
Merged
tdonohue merged 1 commit intoDSpace:mainfrom Sep 15, 2022
Merged
Ensure yarn test:rest reads all JSON data, not just first chunk#1820tdonohue merged 1 commit intoDSpace:mainfrom
yarn test:rest reads all JSON data, not just first chunk#1820tdonohue merged 1 commit intoDSpace:mainfrom
Conversation
Contributor
|
Confirmed that this fixes the issue when testing with the REST API via http and https. Tested against both an nginx reverse proxy (http) and also our F5 load balancer (https). Ensured that both were returning chunked data while testing. |
Member
Author
|
Hello, what should I do exactly to solve this problem? I know maybe I should do a merge. I have Dspace 7.3 installed on my Debian 11 server. Greetings from Argentina |
Member
Author
|
@byteAr : This fix was added in 7.4. The easiest way to apply this fix is to simply upgrade to 7.4. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
References
Fixes issue reported in https://groups.google.com/g/dspace-tech/c/XU7KFZGOr94/m/aeAlQZo5BQAJ
Description
Some proxies (namely nginx) may chunk JSON data in responses from the REST API. This tiny PR ensures that the
yarn test:restscript can handle chunked data.Simply put, it updates the existing code to use the 'data' and 'end' events to ensure that we don't just read the first chunk of data, and instead keep reading until the 'end' event fires. See the docs on
http.ClientRequestfor more details: https://nodejs.org/api/http.html#class-httpclientrequestInstructions for Reviewers
yarn test:reston a valid REST API and ensure it works. If you happen to have a REST API where data is returned in chunks that'd be even better.This PR is based heavily on code sent to me by Sean Kalynuk (U of Manitoba) (@uofmsean) who reported to have this fix in this thread: https://groups.google.com/g/dspace-tech/c/XU7KFZGOr94/m/yZPYL6xBCgAJ