Skip to content

Commit

Permalink
[JENKINS-71236] Stapler Ajax Proxy is broken (regression in 2.404) (#459
Browse files Browse the repository at this point in the history
)
  • Loading branch information
basil authored May 10, 2023
1 parent 56a94d9 commit f9cb74a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/src/main/resources/org/kohsuke/stapler/bind.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,22 @@ function makeStaplerProxy(url,staplerCrumb,methods) {
})
.then(function(response) {
if (response.ok) {
var t = {
status: response.status,
statusText: response.statusText,
};
if (response.headers.has('content-type') && response.headers.get('content-type').startsWith('application/json')) {
response.json().then(function(responseObject) {
var t = {};
t.responseObject = function() {
return responseObject;
};
t.responseJSON = responseObject;
if (callback != null) {
callback(t);
}
});
} else {
response.text().then(function(responseText) {
var t = {};
t.responseText = responseText;
if (callback != null) {
callback(t);
Expand Down

0 comments on commit f9cb74a

Please sign in to comment.