commit | d7027752887e902cbce3132ab115859b089a6899 | [log] [tgz] |
---|---|---|
author | Kamil Musin <kamilm@google.com> | Mon Aug 26 14:04:22 2024 +0200 |
committer | Kamil Musin <kamilm@google.com> | Mon Aug 26 14:11:00 2024 +0200 |
tree | af6ca8d9c4a5399918d6147b4ce01a516aec06d7 | |
parent | 2e90c2a8b3e1523f928616cec1d603392e86b532 [diff] |
Fix the 204 handling in rest api call. callAction method is using .send() method of plugin rest api. This method expects that there is JSON to parse in the response. This is not true, since one of the relevant endpoints returns 204 with no payload. Link to fetch API: https://gerrit.googlesource.com/gerrit/+/refs/heads/master/polygerrit-ui/app/api/rest.ts#40 Since the code never inspects the payload anyway, we can simply replace send() call with fetch call. To match error handling behaviour of send() we pass throwingErrorCallback as errFn. Additionally remove "network" from the error message, since not only the network error would end up in the catch(). (Before this change as well). Note: the tests in automerger.ts have been broken and outdated at least since I12ffd0433 . Fixing them is out of scope of this change. Google-Bug-Id: b/361169276 Change-Id: I1f6a1145307ce4f5d813552326c5ae3875039599
See src/main/resources/documentation.
For running unit tests execute:
bazel test --test_output=all //plugins/automerger/web:karma_test
For checking or fixing eslint formatter problems run:
bazel test //plugins/automerger/web:lint_test bazel run //plugins/automerger/web:lint_bin -- --fix "$(pwd)/plugins/automerger/web"
For testing the plugin with Gerrit FE Dev Helper build the JavaScript bundle and copy it to the plugins/
folder:
bazel build //plugins/automerger/web:automerger cp -f bazel-bin/plugins/automerger/web/automerger.js plugins/
and let the Dev Helper redirect from .+/plugins/automerger/static/automerger.js
to http://localhost:8081/plugins_/automerger.js
.