From 23f8c09f882af1233ac45e1ec8a3b1838c7d621d Mon Sep 17 00:00:00 2001 From: Ankit Saini Date: Mon, 10 May 2021 10:13:20 +0530 Subject: [PATCH 1/2] Fix documentation for timeout setting in curl codegen --- codegens/curl/README.md | 2 +- codegens/curl/lib/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/codegens/curl/README.md b/codegens/curl/README.md index c52d53451..d5ddc188b 100644 --- a/codegens/curl/README.md +++ b/codegens/curl/README.md @@ -18,7 +18,7 @@ Convert function takes three parameters * `indentCount` - The number of indentation characters to add per code level * `trimRequestBody` - Trim request body fields * `followRedirect` - Boolean denoting whether to redirect a request - * `requestTimeout` - Integer denoting time after which the request will bail out in milli-seconds + * `requestTimeout` - Integer denoting time after which the request will bail out in seconds * `multiLine` - Boolean denoting whether to output code snippet with multi line breaks * `longFormat` - Boolean denoting whether to use longform cURL options in snippet * `quoteType` - String denoting the quote type to use (single or double) for URL diff --git a/codegens/curl/lib/index.js b/codegens/curl/lib/index.js index 268815365..80e385a25 100644 --- a/codegens/curl/lib/index.js +++ b/codegens/curl/lib/index.js @@ -226,7 +226,7 @@ self = module.exports = { id: 'requestTimeout', type: 'positiveInteger', default: 0, - description: 'Set number of milliseconds the request should wait for a response before ' + + description: 'Set number of seconds the request should wait for a response before ' + 'timing out (use 0 for infinity)' }, { From a5542c646ecfa651ce6b5fab66303d4d9c34a933 Mon Sep 17 00:00:00 2001 From: Ankit Saini Date: Mon, 10 May 2021 11:05:13 +0530 Subject: [PATCH 2/2] Add in option - requestTimeoutInSeconds --- codegens/curl/README.md | 2 +- codegens/curl/lib/index.js | 6 +++--- test/codegen/structure.test.js | 8 ++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/codegens/curl/README.md b/codegens/curl/README.md index d5ddc188b..a9962c100 100644 --- a/codegens/curl/README.md +++ b/codegens/curl/README.md @@ -18,7 +18,7 @@ Convert function takes three parameters * `indentCount` - The number of indentation characters to add per code level * `trimRequestBody` - Trim request body fields * `followRedirect` - Boolean denoting whether to redirect a request - * `requestTimeout` - Integer denoting time after which the request will bail out in seconds + * `requestTimeoutInSeconds` - Integer denoting time after which the request will bail out in seconds * `multiLine` - Boolean denoting whether to output code snippet with multi line breaks * `longFormat` - Boolean denoting whether to use longform cURL options in snippet * `quoteType` - String denoting the quote type to use (single or double) for URL diff --git a/codegens/curl/lib/index.js b/codegens/curl/lib/index.js index 80e385a25..253ffedc8 100644 --- a/codegens/curl/lib/index.js +++ b/codegens/curl/lib/index.js @@ -18,7 +18,7 @@ self = module.exports = { format, snippet, silent, url, quoteType; redirect = options.followRedirect; - timeout = options.requestTimeout; + timeout = options.requestTimeoutInSeconds; multiLine = options.multiLine; format = options.longFormat; trim = options.trimRequestBody; @@ -222,8 +222,8 @@ self = module.exports = { '(Use double quotes when running curl in cmd.exe and single quotes for the rest)' }, { - name: 'Set request timeout', - id: 'requestTimeout', + name: 'Set request timeout (in seconds)', + id: 'requestTimeoutInSeconds', type: 'positiveInteger', default: 0, description: 'Set number of seconds the request should wait for a response before ' + diff --git a/test/codegen/structure.test.js b/test/codegen/structure.test.js index 7fbdf0b4d..a70d9629a 100644 --- a/test/codegen/structure.test.js +++ b/test/codegen/structure.test.js @@ -44,6 +44,13 @@ const expectedOptions = { description: 'Set number of milliseconds the request should wait' + ' for a response before timing out (use 0 for infinity)' }, + requestTimeoutInSeconds: { + name: 'Set request timeout (in seconds)', + type: 'positiveInteger', + default: 0, + description: 'Set number of seconds the request should wait' + + ' for a response before timing out (use 0 for infinity)' + }, followRedirect: { name: 'Follow redirects', type: 'boolean', @@ -84,6 +91,7 @@ const expectedOptions = { 'indentCount', 'trimRequestBody', 'requestTimeout', + 'requestTimeoutInSeconds', 'silent', 'includeBoilerplate', 'followRedirect',