Skip to content

Commit

Permalink
patched value handling order
Browse files Browse the repository at this point in the history
  • Loading branch information
RedMan13 committed Jul 11, 2023
1 parent c0b8f2d commit 8e255c9
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions extensions/godslayerakp/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,34 +590,34 @@
// eslint-disable-next-line require-await
async sendRequest(args) {
const url = Cast.toString(args.url);

this.clearAll();
const options = this.request.options

Check warning on line 593 in extensions/godslayerakp/http.js

View workflow job for this annotation

GitHub Actions / build

Missing semicolon

Check warning on line 594 in extensions/godslayerakp/http.js

View workflow job for this annotation

GitHub Actions / build

Trailing spaces not allowed
this.clearAll()

Check warning on line 595 in extensions/godslayerakp/http.js

View workflow job for this annotation

GitHub Actions / build

Missing semicolon

this.response.url = url;
Scratch.fetch(url, this.request.options)
.then(res => {
// @ts-ignore
this.response.status = res.status;
this.response.headers = res.headers;
this.response.statusText = res.statusText;
if (res.ok) {
this.request.success = true;
this.request.events.activate('reqSuccess');
} else {
this.request.fail = true;
this.request.events.activate('reqFail');
}
this.request.end = true;
return res.text();
})
.then(body => this.response.text = body)
.catch(err => {
this.response.error = String(err);
console.warn('request failed with error', err);
try {
const res = await Scratch.fetch(url, options)

Check warning on line 599 in extensions/godslayerakp/http.js

View workflow job for this annotation

GitHub Actions / build

Missing semicolon
// @ts-ignore
this.response.status = res.status;
this.response.headers = res.headers;
this.response.statusText = res.statusText;
if (res.ok) {
this.request.success = true;
this.request.events.activate('reqSuccess');
} else {
this.request.fail = true;
this.request.end = true;
this.request.events.activate('reqFail');
});
}
this.request.end = true;
const body = await res.text()

Check warning on line 612 in extensions/godslayerakp/http.js

View workflow job for this annotation

GitHub Actions / build

Missing semicolon
this.response.text = body

Check warning on line 613 in extensions/godslayerakp/http.js

View workflow job for this annotation

GitHub Actions / build

Missing semicolon
} catch (err) {
this.response.error = String(err);
console.warn('request failed with error', err);
this.request.fail = true;
this.request.end = true;
this.request.events.activate('reqFail');
}
}

/* extra stuff for when its missing something */
Expand Down

0 comments on commit 8e255c9

Please sign in to comment.