From 75c6b6179b3d960d51a4cebc3f201b3712cc369a Mon Sep 17 00:00:00 2001 From: insytes Date: Sat, 14 Dec 2024 04:41:08 +0000 Subject: [PATCH 1/3] Update index.d.ts --- packages/background-http/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/background-http/index.d.ts b/packages/background-http/index.d.ts index 79446eda..964a8df8 100644 --- a/packages/background-http/index.d.ts +++ b/packages/background-http/index.d.ts @@ -169,6 +169,11 @@ export interface Request { */ description: string; + /** + * iOS only. Sets NSMutableURLRequest.timeoutInterval value in seconds (s) + */ + timeout?: number + /** * Use utf8 encode in requests */ From 5da5d612d524e9c87be2895c2270b90da6c3dc16 Mon Sep 17 00:00:00 2001 From: insytes Date: Sat, 14 Dec 2024 04:42:53 +0000 Subject: [PATCH 2/3] Update index.ios.ts --- packages/background-http/index.ios.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/background-http/index.ios.ts b/packages/background-http/index.ios.ts index 98eb70a1..53a90663 100644 --- a/packages/background-http/index.ios.ts +++ b/packages/background-http/index.ios.ts @@ -177,6 +177,10 @@ class Session implements Session { request.HTTPMethod = options.method; } + if (options.timeout) { + request.timeoutInterval = options.timeout; + } + let fileURL: NSURL; if (fileUri.substr(0, 7) === "file://") { // File URI in string format From 50b8c29004fc77177e9cbe12d20a038e3105f9c4 Mon Sep 17 00:00:00 2001 From: insytes Date: Sat, 14 Dec 2024 04:45:54 +0000 Subject: [PATCH 3/3] Update README.md --- packages/background-http/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/background-http/README.md b/packages/background-http/README.md index b927d160..9427090d 100644 --- a/packages/background-http/README.md +++ b/packages/background-http/README.md @@ -296,6 +296,7 @@ The request object parameter has the following properties: | `method` | `string` | The request method (e.g. `POST`). | | `headers` | `object` | Used to specify additional headers. | | `description` | `string` | Used to help identify the upload task locally - not sent to the remote server. | +| `timeout` | `number` | (`iOS only`) Sets the request timeout in seconds (s). | | `utf8` | `boolean` | (`Android-only`, `multipartUpload()-only`) If true, sets the charset for the multipart request to UTF-8. Default is `false`. | | `androidNotificationOnProgressTitle` | `string` | Use this to set the on progress title shown in the Android notifications center. | | `androidNotificationOnProgressMessage` | `string` | Use this to set the on progress message shown in the Android notifications center. |