@@ -129,12 +129,6 @@ class HttpsResponse implements Https.HttpsResponseLegacy {
129129 toArrayBufferAsync ( ) : Promise < ArrayBuffer > {
130130 throw new Error ( "Method not implemented." ) ;
131131 }
132- toStringAsync ( ) : Promise < string > {
133- throw new Error ( "Method not implemented." ) ;
134- }
135- toJSONAsync ( ) : Promise < any > {
136- throw new Error ( "Method not implemented." ) ;
137- }
138132 // getCallback(resolve, reject) {
139133 // return {
140134 // onBitmap(res) {
@@ -250,6 +244,9 @@ class HttpsResponse implements Https.HttpsResponseLegacy {
250244 return this . stringResponse ;
251245 }
252246 }
247+ toStringAsync ( encoding ?: any ) {
248+ return Promise . resolve ( this . toString ( encoding ) ) ;
249+ }
253250 jsonResponse : any ;
254251 toJSON ( encoding ?: any ) {
255252 if ( this . jsonResponse ) {
@@ -273,6 +270,9 @@ class HttpsResponse implements Https.HttpsResponseLegacy {
273270 return null ;
274271 }
275272 }
273+ toJSONAsync ( ) : Promise < any > {
274+ return Promise . resolve ( this . toJSON ( ) ) ;
275+ }
276276 imageSource : ImageSource ;
277277 toImage ( ) : Promise < ImageSource > {
278278 if ( this . imageSource ) {
@@ -531,7 +531,6 @@ export function createRequest(
531531 cancel : ( ) => task && task . cancel ( ) ,
532532 run ( resolve , reject ) {
533533 const success = function ( task : NSURLSessionDataTask , data ?: any ) {
534-
535534 // TODO: refactor this code with failure one.
536535 let content = useLegacy
537536 ? new HttpsResponse ( data , opts . url )
0 commit comments