Skip to content

Commit

Permalink
✨ Add Request#getResponse() method
Browse files Browse the repository at this point in the history
  • Loading branch information
skerit committed Jan 10, 2024
1 parent f35525c commit f482380
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.8.17 (WIP)

* Add `Request#getResponse()` method

## 0.8.16 (2023-12-21)

* Fix `String#splitOnce(separator)` breaking when the separator is not found
Expand Down
17 changes: 16 additions & 1 deletion lib/request_browser.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
var Request = Classes.Develry.Request,
const RESPONSE = Symbol('response');

let Request = Classes.Develry.Request,
original_send = XMLHttpRequest.prototype.send,
original_open = XMLHttpRequest.prototype.open,
START_SYMBOL = Symbol('start');
Expand Down Expand Up @@ -449,9 +451,22 @@ Request.setMethod(function _make_request() {
}
});

this[RESPONSE] = pledge;

return pledge;
});

/**
* Get the response
*
* @author Jelle De Loecker <[email protected]>
* @since 0.8.17
* @version 0.8.17
*/
Request.setMethod(function getResponse() {
return this[RESPONSE];
});

/**
* Get a response header
*
Expand Down
17 changes: 16 additions & 1 deletion lib/request_server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
var dns_cache,
const RESPONSE = Symbol('response');

let dns_cache,
Request = Blast.Classes.Develry.Request,
https,
http,
Expand Down Expand Up @@ -411,9 +413,22 @@ Request.setMethod(function _make_request(options) {
}
}

this[RESPONSE] = pledge;

return pledge;
});

/**
* Get the response
*
* @author Jelle De Loecker <[email protected]>
* @since 0.8.17
* @version 0.8.17
*/
Request.setMethod(function getResponse() {
return this[RESPONSE];
});

/**
* Get a response header
*
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "protoblast",
"description": "Native object expansion library",
"version": "0.8.16",
"version": "0.8.17-alpha",
"author": "Jelle De Loecker <[email protected]>",
"keywords": [
"prototype",
Expand Down

0 comments on commit f482380

Please sign in to comment.