Bug 33290: Fix incorrect variable in http-client.js

Silly error from
  commit 821808ec31
  Bug 32939: Use APIClient to replace PATCH requests

+        const body = params.body
+            ? typeof str === "string"
+                ? params.body
+                : JSON.stringify(params.body)
+            : undefined;

  typeof str === "string"
must be
  typeof params.body === "string"

Test plan:
With this patch, bug 33289 is not working properly. The body contains
  "pref_var=value"
instead of
  pref_var=value
and the syspref `var` contains `value"`

Sponsored-by: BULAC - http://www.bulac.fr/
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2023-03-21 08:52:42 +01:00 committed by Tomas Cohen Arazi
parent 299903c0d3
commit 17de3a6fee
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -52,7 +52,7 @@ class HttpClient {
post(params = {}) {
const body = params.body
? typeof str === "string"
? typeof params.body === "string"
? params.body
: JSON.stringify(params.body)
: undefined;
@ -65,7 +65,7 @@ class HttpClient {
put(params = {}) {
const body = params.body
? typeof str === "string"
? typeof params.body === "string"
? params.body
: JSON.stringify(params.body)
: undefined;
@ -105,7 +105,7 @@ class HttpClient {
patch(params = {}) {
const body = params.body
? typeof str === "string"
? typeof params.body === "string"
? params.body
: JSON.stringify(params.body)
: undefined;