Skip to content

Commit 09484f5

Browse files
committed
chore: tsc
1 parent 61235bb commit 09484f5

File tree

2 files changed

+38
-40
lines changed

2 files changed

+38
-40
lines changed

packages/https/platforms/ios/src/AlamofireWrapper.swift

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ public class AlamofireWrapper: NSObject {
180180
_ requestId: String,
181181
_ uploadProgress: ((Progress) -> Void)?,
182182
_ downloadProgress: ((Progress) -> Void)?,
183-
_ success: @escaping (NSHTTPURLResponse?, Any?) -> Void,
184-
_ failure: @escaping (NSHTTPURLResponse?, Error) -> Void
183+
_ success: @escaping (HTTPURLResponse?, Any?) -> Void,
184+
_ failure: @escaping (HTTPURLResponse?, Error) -> Void
185185
) {
186186
requestWithThreading(
187187
method,
@@ -209,8 +209,8 @@ public class AlamofireWrapper: NSObject {
209209
_ progressOnMainThread: NSNumber?, // NSNumber wrapper for optional Bool
210210
_ uploadProgress: ((Progress) -> Void)?,
211211
_ downloadProgress: ((Progress) -> Void)?,
212-
_ success: @escaping (NSHTTPURLResponse?, Any?) -> Void,
213-
_ failure: @escaping (NSHTTPURLResponse?, Error) -> Void
212+
_ success: @escaping (HTTPURLResponse?, Any?) -> Void,
213+
_ failure: @escaping (HTTPURLResponse?, Error) -> Void
214214
) {
215215

216216
guard let url = URL(string: urlString) else {
@@ -277,7 +277,7 @@ public class AlamofireWrapper: NSObject {
277277
self.removeRequest(id: requestId)
278278

279279
// Get the HTTP response
280-
let httpResponse = response.response as? NSHTTPURLResponse
280+
let httpResponse = response.response as? HTTPURLResponse
281281

282282
if let error = response.error {
283283
let nsError = self.createNSError(from: error, response: response.response, data: response.data)
@@ -303,8 +303,8 @@ public class AlamofireWrapper: NSObject {
303303
_ requestId: String,
304304
_ constructingBodyWithBlock: @escaping (MultipartFormDataWrapper) -> Void,
305305
_ progress: ((Progress) -> Void)?,
306-
_ success: @escaping (NSHTTPURLResponse?, Any?) -> Void,
307-
_ failure: @escaping (NSHTTPURLResponse?, Error) -> Void
306+
_ success: @escaping (HTTPURLResponse?, Any?) -> Void,
307+
_ failure: @escaping (HTTPURLResponse?, Error) -> Void
308308
) {
309309
uploadMultipartWithThreading(
310310
urlString,
@@ -328,8 +328,8 @@ public class AlamofireWrapper: NSObject {
328328
_ progressOnMainThread: NSNumber?,
329329
_ constructingBodyWithBlock: @escaping (MultipartFormDataWrapper) -> Void,
330330
_ progress: ((Progress) -> Void)?,
331-
_ success: @escaping (NSHTTPURLResponse?, Any?) -> Void,
332-
_ failure: @escaping (NSHTTPURLResponse?, Error) -> Void
331+
_ success: @escaping (HTTPURLResponse?, Any?) -> Void,
332+
_ failure: @escaping (HTTPURLResponse?, Error) -> Void
333333
) {
334334

335335
guard let url = URL(string: urlString) else {
@@ -392,7 +392,7 @@ public class AlamofireWrapper: NSObject {
392392
self.removeRequest(id: requestId)
393393

394394
// Get the HTTP response
395-
let httpResponse = response.response as? NSHTTPURLResponse
395+
let httpResponse = response.response as? HTTPURLResponse
396396

397397
if let error = response.error {
398398
let nsError = self.createNSError(from: error, response: response.response, data: response.data)
@@ -417,8 +417,8 @@ public class AlamofireWrapper: NSObject {
417417
_ fileURL: URL,
418418
_ requestId: String,
419419
_ progress: ((Progress) -> Void)?,
420-
_ success: @escaping (NSHTTPURLResponse?, Any?) -> Void,
421-
_ failure: @escaping (NSHTTPURLResponse?, Error) -> Void
420+
_ success: @escaping (HTTPURLResponse?, Any?) -> Void,
421+
_ failure: @escaping (HTTPURLResponse?, Error) -> Void
422422
) {
423423

424424
var afRequest = session.upload(fileURL, with: request)
@@ -451,7 +451,7 @@ public class AlamofireWrapper: NSObject {
451451
self.removeRequest(id: requestId)
452452

453453
// Get the HTTP response
454-
let httpResponse = response.response as? NSHTTPURLResponse
454+
let httpResponse = response.response as? HTTPURLResponse
455455

456456
if let error = response.error {
457457
let nsError = self.createNSError(from: error, response: response.response, data: response.data)
@@ -474,8 +474,8 @@ public class AlamofireWrapper: NSObject {
474474
_ bodyData: Data,
475475
_ requestId: String,
476476
_ progress: ((Progress) -> Void)?,
477-
_ success: @escaping (NSHTTPURLResponse?, Any?) -> Void,
478-
_ failure: @escaping (NSHTTPURLResponse?, Error) -> Void
477+
_ success: @escaping (HTTPURLResponse?, Any?) -> Void,
478+
_ failure: @escaping (HTTPURLResponse?, Error) -> Void
479479
) {
480480

481481
var afRequest = session.upload(bodyData, with: request)
@@ -508,7 +508,7 @@ public class AlamofireWrapper: NSObject {
508508
self.removeRequest(id: requestId)
509509

510510
// Get the HTTP response
511-
let httpResponse = response.response as? NSHTTPURLResponse
511+
let httpResponse = response.response as? HTTPURLResponse
512512

513513
if let error = response.error {
514514
let nsError = self.createNSError(from: error, response: response.response, data: response.data)
@@ -537,8 +537,8 @@ public class AlamofireWrapper: NSObject {
537537
_ headers: NSDictionary?,
538538
_ requestId: String,
539539
_ progress: ((Progress) -> Void)?,
540-
_ success: @escaping (NSHTTPURLResponse?, String?) -> Void,
541-
_ failure: @escaping (NSHTTPURLResponse?, Error) -> Void
540+
_ success: @escaping (HTTPURLResponse?, String?) -> Void,
541+
_ failure: @escaping (HTTPURLResponse?, Error) -> Void
542542
) {
543543

544544
guard let url = URL(string: urlString) else {
@@ -602,7 +602,7 @@ public class AlamofireWrapper: NSObject {
602602
self.removeRequest(id: requestId)
603603

604604
// Get the HTTP response
605-
let httpResponse = response.response as? NSHTTPURLResponse
605+
let httpResponse = response.response as? HTTPURLResponse
606606

607607
if let error = response.error {
608608
let nsError = self.createNSError(from: error, response: response.response, data: nil)
@@ -627,8 +627,8 @@ public class AlamofireWrapper: NSObject {
627627
_ headers: NSDictionary?,
628628
_ requestId: String,
629629
_ progress: ((Progress) -> Void)?,
630-
_ success: @escaping (NSHTTPURLResponse?, String?) -> Void,
631-
_ failure: @escaping (NSHTTPURLResponse?, Error) -> Void
630+
_ success: @escaping (HTTPURLResponse?, String?) -> Void,
631+
_ failure: @escaping (HTTPURLResponse?, Error) -> Void
632632
) {
633633

634634
guard let url = URL(string: urlString) else {
@@ -691,7 +691,7 @@ public class AlamofireWrapper: NSObject {
691691
self.removeRequest(id: requestId)
692692

693693
// Get the HTTP response
694-
let httpResponse = response.response as? NSHTTPURLResponse
694+
let httpResponse = response.response as? HTTPURLResponse
695695

696696
if let error = response.error {
697697
let nsError = self.createNSError(from: error, response: response.response, data: nil)
@@ -720,9 +720,9 @@ public class AlamofireWrapper: NSObject {
720720
_ requestId: String,
721721
_ sizeThreshold: Int64,
722722
_ progress: ((Progress) -> Void)?,
723-
_ headersCallback: @escaping (NSHTTPURLResponse?, Int64) -> Void,
724-
_ success: @escaping (NSHTTPURLResponse?, String?) -> Void,
725-
_ failure: @escaping (NSHTTPURLResponse?, Error) -> Void
723+
_ headersCallback: @escaping (HTTPURLResponse?, Int64) -> Void,
724+
_ success: @escaping (HTTPURLResponse?, String?) -> Void,
725+
_ failure: @escaping (HTTPURLResponse?, Error) -> Void
726726
) {
727727

728728
guard let url = URL(string: urlString) else {
@@ -772,7 +772,7 @@ public class AlamofireWrapper: NSObject {
772772

773773
// Call headersCallback on first response (only once)
774774
callbackState.callOnce {
775-
let httpResponse = response as? NSHTTPURLResponse
775+
let httpResponse = response as? HTTPURLResponse
776776
let contentLength = response.expectedContentLength
777777
headersCallback(httpResponse, contentLength)
778778
}
@@ -787,7 +787,7 @@ public class AlamofireWrapper: NSObject {
787787

788788
// Apply interceptors
789789
for interceptor in requestInterceptors {
790-
downloadRequest = downloadRequest.interceptor(interceptor) as! DownloadRequest
790+
downloadRequest = downloadRequest.interceptor(interceptor)
791791
}
792792

793793
// Apply server trust evaluation if security policy is set
@@ -810,7 +810,7 @@ public class AlamofireWrapper: NSObject {
810810
self.removeRequest(id: requestId)
811811

812812
// Get the HTTP response
813-
let httpResponse = response.response as? NSHTTPURLResponse
813+
let httpResponse = response.response as? HTTPURLResponse
814814

815815
if let error = response.error {
816816
let nsError = self.createNSError(from: error, response: response.response, data: nil)
@@ -843,8 +843,8 @@ public class AlamofireWrapper: NSObject {
843843
_ requestId: String,
844844
_ sizeThreshold: Int64,
845845
_ progress: ((Progress) -> Void)?,
846-
_ success: @escaping (NSHTTPURLResponse?, Any?, String?) -> Void,
847-
_ failure: @escaping (NSHTTPURLResponse?, Error) -> Void
846+
_ success: @escaping (HTTPURLResponse?, Any?, String?) -> Void,
847+
_ failure: @escaping (HTTPURLResponse?, Error) -> Void
848848
) {
849849

850850
guard let url = URL(string: urlString) else {
@@ -899,7 +899,7 @@ public class AlamofireWrapper: NSObject {
899899
self.removeRequest(id: requestId)
900900

901901
// Get the HTTP response
902-
let httpResponse = response.response as? NSHTTPURLResponse
902+
let httpResponse = response.response as? HTTPURLResponse
903903

904904
if let error = response.error {
905905
let nsError = self.createNSError(from: error, response: response.response, data: response.data)

src/https/request.ios.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ function AFFailure(resolve, reject, httpResponse: NSHTTPURLResponse, error: NSEr
400400
return getHeaders();
401401
}
402402
} as any as HttpsResponse;
403-
403+
404404
// Try to get response from error or use the one passed in
405405
const response = httpResponse || (error.userInfo.valueForKey(AFNetworkingOperationFailingURLResponseErrorKey) as NSHTTPURLResponse);
406406
if (!Utils.isNullOrUndefined(response)) {
@@ -419,7 +419,7 @@ function AFFailure(resolve, reject, httpResponse: NSHTTPURLResponse, error: NSEr
419419
const data: NSDictionary<string, any> & NSData & NSArray<any> = error.userInfo.valueForKey(AFNetworkingOperationFailingURLResponseDataErrorKey);
420420
const parsedData = getData(data);
421421
const failingURL = error.userInfo.objectForKey('NSErrorFailingURLKey');
422-
422+
423423
// Always use legacy response
424424
if (!sendi.statusCode) {
425425
return reject(error);
@@ -451,7 +451,7 @@ function bodyToNative(cont) {
451451
return dict;
452452
}
453453

454-
const runningRequests: { [k: string]: string } = {}; // Maps tag to request ID
454+
const runningRequests: { [k: string]: string } = {}; // Maps tag to request ID
455455

456456
export function cancelRequest(tag: string) {
457457
const requestId = runningRequests[tag];
@@ -542,7 +542,7 @@ export function createRequest(opts: HttpsRequestOptions): HttpsRequest {
542542
}
543543
return {
544544
get nativeRequest() {
545-
return null; // We no longer expose the task
545+
return null; // We no longer expose the task
546546
},
547547
cancel: () => {
548548
const rid = runningRequests[tag];
@@ -707,9 +707,7 @@ export function createRequest(opts: HttpsRequestOptions): HttpsRequest {
707707

708708
// If we got a temp file path, response was saved to file (large)
709709
// If we got responseData, response is in memory (small)
710-
const content = tempFilePath
711-
? new HttpsResponseLegacy(null, contentLength, opts.url, tempFilePath)
712-
: new HttpsResponseLegacy(responseData, contentLength, opts.url);
710+
const content = tempFilePath ? new HttpsResponseLegacy(null, contentLength, opts.url, tempFilePath) : new HttpsResponseLegacy(responseData, contentLength, opts.url);
713711

714712
let getHeaders = () => ({});
715713
const sendi = {
@@ -754,7 +752,7 @@ export function createRequest(opts: HttpsRequestOptions): HttpsRequest {
754752
if (tag) {
755753
runningRequests[tag] = requestId;
756754
}
757-
755+
758756
manager.downloadToTempWithEarlyHeaders(
759757
opts.method,
760758
opts.url,
@@ -814,7 +812,7 @@ export function createRequest(opts: HttpsRequestOptions): HttpsRequest {
814812
if (tag) {
815813
runningRequests[tag] = requestId;
816814
}
817-
815+
818816
manager.downloadToTemp(
819817
opts.method,
820818
opts.url,

0 commit comments

Comments
 (0)