File tree 1 file changed +12
-3
lines changed
1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -100,7 +100,6 @@ function Response(nativeResponse) {
100
100
this . url = nativeResponse . url ;
101
101
102
102
this . _response = nativeResponse ;
103
- this . _blob = null ;
104
103
this . _json = null ;
105
104
this . _text = null ;
106
105
@@ -151,12 +150,22 @@ Response.prototype = {
151
150
throw new Error ( 'Not implemented.' ) ;
152
151
} ,
153
152
json ( ) {
153
+ if ( this . _json !== null ) {
154
+ return this . _json ;
155
+ }
154
156
const buffer = readResult ( this . _result ) ;
155
- return JSON . parse ( buffer . toString ( ) ) ;
157
+ const json = JSON . parse ( buffer . toString ( ) ) ;
158
+ this . _json = json ;
159
+ return json ;
156
160
} ,
157
161
text ( ) {
162
+ if ( this . _text !== null ) {
163
+ return this . _text ;
164
+ }
158
165
const buffer = readResult ( this . _result ) ;
159
- return buffer . toString ( ) ;
166
+ const text = buffer . toString ( ) ;
167
+ this . _text = text ;
168
+ return text ;
160
169
} ,
161
170
} ;
162
171
You can’t perform that action at this time.
0 commit comments