GeezerVison is showing github.com — Merge remote-tracking branch 'origin/refactor' · nativescript-community/https@9a2d6df
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: docs/assets/navigation.js +1-1Lines changed: 1 addition & 1 deletion Collapse file Copy file name to clipboardExpand all lines: docs/assets/search.js +1-1Lines changed: 1 addition & 1 deletion Collapse file Copy file name to clipboardExpand all lines: src/https/request.ios.ts +20-32Lines changed: 20 additions & 32 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -463,14 +463,19 @@ export function createRequest(opts: HttpsRequestOptions, useLegacy: boolean = tr | 463 | 463 | } | 464 | 464 | } else if (opts.method === 'PUT'){ | 465 | 465 | if (opts.body instanceof File) { | 466 | | - const request = NSURLRequest.requestWithURL(NSURL.URLWithString(opts.url)); | | 466 | + const request = NSMutableURLRequest.alloc().initWithURL(NSURL.URLWithString(opts.url)); | | 467 | + request.HTTPMethod = opts.method; | | 468 | + Object.keys(heads).forEach(k=>{ | | 469 | + request.setValueForHTTPHeaderField(heads[k], k); | | 470 | + }); | 467 | 471 | task = manager.uploadTaskWithRequestFromFileProgressCompletionHandler(request, NSURL.fileURLWithPath(opts.body.path), progress, (response: NSURLResponse, responseObject: any, error: NSError)=>{ | 468 | 472 | if (error){ | 469 | 473 | failure(task, error); | 470 | 474 | } else { | 471 | 475 | success(task, responseObject); | 472 | 476 | } | 473 | 477 | }); | | 478 | + task.resume(); | 474 | 479 | } else { | 475 | 480 | let data: NSData; | 476 | 481 | // TODO: add support for Buffers | @@ -481,14 +486,19 @@ export function createRequest(opts: HttpsRequestOptions, useLegacy: boolean = tr | 481 | 486 | } else { | 482 | 487 | data = NSString.stringWithString(JSON.stringify(opts.body)).dataUsingEncoding(NSUTF8StringEncoding); | 483 | 488 | } | 484 | | - const request = NSURLRequest.requestWithURL(NSURL.URLWithString(opts.url)); | 485 | | - task = manager.uploadTaskWithRequestFromDataProgressCompletionHandler(request, data, progress, (response: NSURLResponse, responseObject: any, error: NSError)=>{ | 486 | | - if (error){ | 487 | | - failure(task, error); | 488 | | - } else { | 489 | | - success(task, responseObject); | 490 | | - } | 491 | | - }); | | 489 | + const request = NSMutableURLRequest.alloc().initWithURL(NSURL.URLWithString(opts.url)); | | 490 | + request.HTTPMethod = opts.method; | | 491 | + Object.keys(heads).forEach(k=>{ | | 492 | + request.setValueForHTTPHeaderField(heads[k], k); | | 493 | + }); | | 494 | + task = manager.uploadTaskWithRequestFromDataProgressCompletionHandler(request, data, progress, (response: NSURLResponse, responseObject: any, error: NSError)=>{ | | 495 | + if (error){ | | 496 | + failure(task, error); | | 497 | + } else { | | 498 | + success(task, responseObject); | | 499 | + } | | 500 | + }); | | 501 | + task.resume(); | 492 | 502 | } | 493 | 503 | } else { | 494 | 504 | let dict = null; | @@ -498,29 +508,7 @@ export function createRequest(opts: HttpsRequestOptions, useLegacy: boolean = tr | 498 | 508 | dict = NSJSONSerialization.JSONObjectWithDataOptionsError(NSString.stringWithString(opts.content).dataUsingEncoding(NSUTF8StringEncoding), 0 as any); | 499 | 509 | } | 500 | 510 | task = manager.dataTaskWithHTTPMethodURLStringParametersHeadersUploadProgressDownloadProgressSuccessFailure(opts.method, opts.url, dict, headers, progress, progress, success, failure); | 501 | | - // switch (opts.method) { | 502 | | - // case 'GET': | 503 | | - // task = manager.GETParametersHeadersProgressSuccessFailure(opts.url, dict, headers, progress, success, failure); | 504 | | - // manager.requestSerializer.requestWithMethodURLStringParametersError(method, URLString, parameters) | 505 | | - // break; | 506 | | - // case 'POST': | 507 | | - // task = manager.POSTParametersHeadersProgressSuccessFailure(opts.url, dict, headers, progress, success, failure); | 508 | | - // break; | 509 | | - // case 'PUT': | 510 | | - // task = manager.PUTParametersHeadersSuccessFailure(opts.url, dict, headers, success, failure); | 511 | | - // break; | 512 | | - // case 'DELETE': | 513 | | - // task = manager.DELETEParametersHeadersSuccessFailure(opts.url, dict, headers, success, failure); | 514 | | - // break; | 515 | | - // case 'PATCH': | 516 | | - // task = manager.PATCHParametersHeadersSuccessFailure(opts.url, dict, headers, success, failure); | 517 | | - // break; | 518 | | - // case 'HEAD': | 519 | | - // task = manager.HEADParametersHeadersSuccessFailure(opts.url, dict, headers, success, failure); | 520 | | - // break; | 521 | | - // default: | 522 | | - // throw new Error('method_not_supported_multipart'); | 523 | | - // } | | 511 | + task.resume(); | 524 | 512 | } | 525 | 513 | if (task && tag) { | 526 | 514 | runningRequests[tag] = task; | |
Collapse file Copy file name to clipboardExpand all lines: yarn.lock +15-15Lines changed: 15 additions & 15 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1986,7 +1986,7 @@ __metadata: | 1986 | 1986 |
| 1987 | 1987 | "@nativescript-community/plugin-seed-tools@file:tools::locator=root-workspace-0b6124%40workspace%3A.": | 1988 | 1988 | version: 1.0.0 | 1989 | | - resolution: "@nativescript-community/plugin-seed-tools@file:tools#tools::hash=d71f44&locator=root-workspace-0b6124%40workspace%3A." | | 1989 | + resolution: "@nativescript-community/plugin-seed-tools@file:tools#tools::hash=3f94d6&locator=root-workspace-0b6124%40workspace%3A." | 1990 | 1990 | dependencies: | 1991 | 1991 | "@angular/animations": ~16.2.8 | 1992 | 1992 | "@angular/common": ~16.2.8 | @@ -2051,7 +2051,7 @@ __metadata: | 2051 | 2051 | vue: ~2.6.14 | 2052 | 2052 | yargs: ^17.7.2 | 2053 | 2053 | zone.js: ~0.14.0 | 2054 | | - checksum: 2059f167166f1aaa5f3486fa3c0a0fadbe457879cfcff2eb46dd3d33d904d9dc2c2c785b98936d515ef58703a2dfda4bda014965d62e5ad5af361b8905e0c94f | | 2054 | + checksum: ab4dab79711f100a4d1bea3c43b9f044b8577fa5a98f17e173e3ae57e966d8c47ae20c75f185e4c9ab79643587bcb7c283f094996ad73e2017e7b2897eac6806 | 2055 | 2055 | languageName: node | 2056 | 2056 | linkType: hard | 2057 | 2057 |
| @@ -2065,10 +2065,10 @@ __metadata: | 2065 | 2065 |
| 2066 | 2066 | "@nativescript-community/template-snippet@file:demo-snippets::locator=root-workspace-0b6124%40workspace%3A.": | 2067 | 2067 | version: 0.0.1 | 2068 | | - resolution: "@nativescript-community/template-snippet@file:demo-snippets#demo-snippets::hash=07d2c5&locator=root-workspace-0b6124%40workspace%3A." | | 2068 | + resolution: "@nativescript-community/template-snippet@file:demo-snippets#demo-snippets::hash=a8c89e&locator=root-workspace-0b6124%40workspace%3A." | 2069 | 2069 | dependencies: | 2070 | 2070 | "@nativescript-community/https": 4.0.11 | 2071 | | - checksum: 0034d1e678e6ffbb0d898b54ba4bde0216d2005a10c4f49d5b23ed59c03ea64d736eadb4a683bff0bca9031cdd3aa9620f181ab6a3bbe1ce6912408a8841ef6c | | 2071 | + checksum: d3720ea9746733586838c23c20f6eb110349f77ece0429c87d2f98fbb84286be1eb473bd519db1b3a90e0a8d857282ff7dafd8264dc258363285febc8cce3857 | 2072 | 2072 | languageName: node | 2073 | 2073 | linkType: hard | 2074 | 2074 |
| @@ -8120,7 +8120,7 @@ __metadata: | 8120 | 8120 |
| 8121 | 8121 | "fsevents@patch:fsevents@^2.3.2#~builtin<compat/fsevents>, fsevents@patch:fsevents@~2.3.2#~builtin<compat/fsevents>": | 8122 | 8122 | version: 2.3.2 | 8123 | | - resolution: "fsevents@patch:fsevents@npm%3A2.3.2#~builtin<compat/fsevents>::version=2.3.2&hash=df0bf1" | | 8123 | + resolution: "fsevents@patch:fsevents@npm%3A2.3.2#~builtin<compat/fsevents>::version=2.3.2&hash=18f3a7" | 8124 | 8124 | dependencies: | 8125 | 8125 | node-gyp: latest | 8126 | 8126 | conditions: os=darwin | @@ -14181,7 +14181,7 @@ __metadata: | 14181 | 14181 |
| 14182 | 14182 | "resolve@patch:resolve@^1.1.6#~builtin<compat/resolve>, resolve@patch:resolve@^1.1.7#~builtin<compat/resolve>, resolve@patch:resolve@^1.10.0#~builtin<compat/resolve>, resolve@patch:resolve@^1.20.0#~builtin<compat/resolve>, resolve@patch:resolve@^1.22.1#~builtin<compat/resolve>, resolve@patch:resolve@^1.9.0#~builtin<compat/resolve>": | 14183 | 14183 | version: 1.22.1 | 14184 | | - resolution: "resolve@patch:resolve@npm%3A1.22.1#~builtin<compat/resolve>::version=1.22.1&hash=c3c19d" | | 14184 | + resolution: "resolve@patch:resolve@npm%3A1.22.1#~builtin<compat/resolve>::version=1.22.1&hash=07638b" | 14185 | 14185 | dependencies: | 14186 | 14186 | is-core-module: ^2.9.0 | 14187 | 14187 | path-parse: ^1.0.7 | @@ -14194,7 +14194,7 @@ __metadata: | 14194 | 14194 |
| 14195 | 14195 | "resolve@patch:resolve@^2.0.0-next.4#~builtin<compat/resolve>": | 14196 | 14196 | version: 2.0.0-next.4 | 14197 | | - resolution: "resolve@patch:resolve@npm%3A2.0.0-next.4#~builtin<compat/resolve>::version=2.0.0-next.4&hash=c3c19d" | | 14197 | + resolution: "resolve@patch:resolve@npm%3A2.0.0-next.4#~builtin<compat/resolve>::version=2.0.0-next.4&hash=07638b" | 14198 | 14198 | dependencies: | 14199 | 14199 | is-core-module: ^2.9.0 | 14200 | 14200 | path-parse: ^1.0.7 | @@ -16314,7 +16314,7 @@ __metadata: | 16314 | 16314 |
| 16315 | 16315 | "typescript@patch:typescript@^3.5.3#~builtin<compat/typescript>": | 16316 | 16316 | version: 3.9.10 | 16317 | | - resolution: "typescript@patch:typescript@npm%3A3.9.10#~builtin<compat/typescript>::version=3.9.10&hash=3bd3d3" | | 16317 | + resolution: "typescript@patch:typescript@npm%3A3.9.10#~builtin<compat/typescript>::version=3.9.10&hash=a1c5e5" | 16318 | 16318 | bin: | 16319 | 16319 | tsc: bin/tsc | 16320 | 16320 | tsserver: bin/tsserver | @@ -16324,17 +16324,17 @@ __metadata: | 16324 | 16324 |
| 16325 | 16325 | "typescript@patch:typescript@^4.6.4 || ^5.0.0#~builtin<compat/typescript>": | 16326 | 16326 | version: 5.1.6 | 16327 | | - resolution: "typescript@patch:typescript@npm%3A5.1.6#~builtin<compat/typescript>::version=5.1.6&hash=5da071" | | 16327 | + resolution: "typescript@patch:typescript@npm%3A5.1.6#~builtin<compat/typescript>::version=5.1.6&hash=a1c5e5" | 16328 | 16328 | bin: | 16329 | 16329 | tsc: bin/tsc | 16330 | 16330 | tsserver: bin/tsserver | 16331 | | - checksum: f53bfe97f7c8b2b6d23cf572750d4e7d1e0c5fff1c36d859d0ec84556a827b8785077bc27676bf7e71fae538e517c3ecc0f37e7f593be913d884805d931bc8be | | 16331 | + checksum: 21e88b0a0c0226f9cb9fd25b9626fb05b4c0f3fddac521844a13e1f30beb8f14e90bd409a9ac43c812c5946d714d6e0dee12d5d02dfc1c562c5aacfa1f49b606 | 16332 | 16332 | languageName: node | 16333 | 16333 | linkType: hard | 16334 | 16334 |
| 16335 | 16335 | "typescript@patch:typescript@~4.2.3#~builtin<compat/typescript>": | 16336 | 16336 | version: 4.2.4 | 16337 | | - resolution: "typescript@patch:typescript@npm%3A4.2.4#~builtin<compat/typescript>::version=4.2.4&hash=334f98" | | 16337 | + resolution: "typescript@patch:typescript@npm%3A4.2.4#~builtin<compat/typescript>::version=4.2.4&hash=a1c5e5" | 16338 | 16338 | bin: | 16339 | 16339 | tsc: bin/tsc | 16340 | 16340 | tsserver: bin/tsserver | @@ -16344,21 +16344,21 @@ __metadata: | 16344 | 16344 |
| 16345 | 16345 | "typescript@patch:typescript@~4.8.4#~builtin<compat/typescript>": | 16346 | 16346 | version: 4.8.4 | 16347 | | - resolution: "typescript@patch:typescript@npm%3A4.8.4#~builtin<compat/typescript>::version=4.8.4&hash=1a91c8" | | 16347 | + resolution: "typescript@patch:typescript@npm%3A4.8.4#~builtin<compat/typescript>::version=4.8.4&hash=a1c5e5" | 16348 | 16348 | bin: | 16349 | 16349 | tsc: bin/tsc | 16350 | 16350 | tsserver: bin/tsserver | 16351 | | - checksum: c981e82b77a5acdcc4e69af9c56cdecf5b934a87a08e7b52120596701e389a878b8e3f860e73ffb287bf649cc47a8c741262ce058148f71de4cdd88bb9c75153 | | 16351 | + checksum: 563a0ef47abae6df27a9a3ab38f75fc681f633ccf1a3502b1108e252e187787893de689220f4544aaf95a371a4eb3141e4a337deb9895de5ac3c1ca76430e5f0 | 16352 | 16352 | languageName: node | 16353 | 16353 | linkType: hard | 16354 | 16354 |
| 16355 | 16355 | "typescript@patch:typescript@~4.9.5#~builtin<compat/typescript>": | 16356 | 16356 | version: 4.9.5 | 16357 | | - resolution: "typescript@patch:typescript@npm%3A4.9.5#~builtin<compat/typescript>::version=4.9.5&hash=289587" | | 16357 | + resolution: "typescript@patch:typescript@npm%3A4.9.5#~builtin<compat/typescript>::version=4.9.5&hash=a1c5e5" | 16358 | 16358 | bin: | 16359 | 16359 | tsc: bin/tsc | 16360 | 16360 | tsserver: bin/tsserver | 16361 | | - checksum: 1f8f3b6aaea19f0f67cba79057674ba580438a7db55057eb89cc06950483c5d632115c14077f6663ea76fd09fce3c190e6414bb98582ec80aa5a4eaf345d5b68 | | 16361 | + checksum: 2eee5c37cad4390385db5db5a8e81470e42e8f1401b0358d7390095d6f681b410f2c4a0c496c6ff9ebd775423c7785cdace7bcdad76c7bee283df3d9718c0f20 | 16362 | 16362 | languageName: node | 16363 | 16363 | linkType: hard | 16364 | 16364 |
| |
|