Skip to content

Commit

Permalink
Pass POST parameters in body rather than query string (jenkinsci#1487)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Jul 18, 2023
1 parent 6e66545 commit 12ff39e
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit 12ff39e

Please sign in to comment.