From 12ff39ee2d1b09401a2c8314753dc61145ba628f Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Tue, 18 Jul 2023 10:41:03 -0700 Subject: [PATCH] Pass POST parameters in body rather than query string (#1487) --- .../git/ApiTokenPropertyConfiguration/resources.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/resources/hudson/plugins/git/ApiTokenPropertyConfiguration/resources.js b/src/main/resources/hudson/plugins/git/ApiTokenPropertyConfiguration/resources.js index 55a4a3d8f0..ea6b9997c3 100644 --- a/src/main/resources/hudson/plugins/git/ApiTokenPropertyConfiguration/resources.js +++ b/src/main/resources/hudson/plugins/git/ApiTokenPropertyConfiguration/resources.js @@ -20,9 +20,12 @@ function revokeApiToken(anchorRevoke) { const apiTokenUuid = inputUuid.value; if (confirm(confirmMessage)) { - fetch(targetUrl + "?" + new URLSearchParams({apiTokenUuid: apiTokenUuid}), { - headers: crumb.wrap({}), + fetch(targetUrl, { + headers: crumb.wrap({ + "Content-Type": "application/x-www-form-urlencoded", + }), method: "post", + body: new URLSearchParams({apiTokenUuid: apiTokenUuid}), }).then((rsp) => { if (rsp.ok) { repeatedChunk.remove(); @@ -59,9 +62,12 @@ function saveApiToken(button){ const nameInput = repeatedChunk.querySelector('.api-token-name-input'); const apiTokenName = nameInput.value; - fetch(targetUrl + "?" + new URLSearchParams({apiTokenName: apiTokenName}), { - headers: crumb.wrap({}), + fetch(targetUrl, { + headers: crumb.wrap({ + "Content-Type": "application/x-www-form-urlencoded", + }), method: "post", + body: new URLSearchParams({apiTokenName: apiTokenName}), }).then((rsp) => { if (rsp.ok) { rsp.json().then((json) => {