Skip to content

Commit 20a74b6

Browse files
committed
fix(ios): toStringAsync && toJSONAsync
1 parent 98f01e8 commit 20a74b6

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/https.ios.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)