@jnode/request 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.js +2 -2
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -139,11 +139,11 @@ class RequestResponse {
|
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
async text(encoding = 'utf8') {
|
|
142
|
-
return this['_text_' + encoding]
|
|
142
|
+
return this['_text_' + encoding] ?? (this['_text_' + encoding] = (await this.buffer()).toString(encoding));
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
async json(encoding = 'utf8') {
|
|
146
|
-
return this['_json_' + encoding]
|
|
146
|
+
return this['_json_' + encoding] ?? (this['_json_' + encoding] = JSON.parse(await this.text(encoding)));
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
rl() {
|