Skip to content

Commit

Permalink
Rename MaxTimeout to Timeout as per the latest RestSharp version
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-v-singh committed May 24, 2024
1 parent 699c3ee commit cd18aae
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions codegens/csharp-restsharp/lib/restsharp.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ function makeOptionsSnippet (urlOrigin, options, indentString, headers) {
});
}
if (options.requestTimeout) {
snippet += `${indentString}MaxTimeout = ${options.requestTimeout},\n`;
snippet += `${indentString}Timeout = ${options.requestTimeout},\n`;
}
else {
snippet += `${indentString}MaxTimeout = -1,\n`;
snippet += `${indentString}Timeout = -1,\n`;
}
if (!options.followRedirect) {
snippet += `${indentString}FollowRedirects = false,\n`;
Expand Down
2 changes: 1 addition & 1 deletion codegens/csharp-restsharp/test/unit/convert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('csharp restsharp function', function () {
expect.fail(null, null, error);
}
expect(snippet).to.be.a('string');
expect(snippet).to.include('MaxTimeout = 5');
expect(snippet).to.include('Timeout = 5');
});
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"result" : "var options = new RestClientOptions(\"https://postman-echo.com\")\n{\n\tMaxTimeout = -1,\n};\nvar client = new RestClient(options);\nvar request = new RestRequest(\"/post/?hardik=\\\"me\\\"\", Method.Post);\nrequest.AddHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\nrequest.AddParameter(\"1\", \"a\");\nrequest.AddParameter(\"2\", \"b\");\nrequest.AddParameter(\"\\\"\\\"12\\\"\\\"\", \"\\\"23\\\"\");\nrequest.AddParameter(\"'1\\\"2\\\\\\\"\\\"3'\", \"'1\\\"23\\\"4'\");\nRestResponse response = await client.ExecuteAsync(request);\nConsole.WriteLine(response.Content);"
"result" : "var options = new RestClientOptions(\"https://postman-echo.com\")\n{\n\tTimeout = -1,\n};\nvar client = new RestClient(options);\nvar request = new RestRequest(\"/post/?hardik=\\\"me\\\"\", Method.Post);\nrequest.AddHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\nrequest.AddParameter(\"1\", \"a\");\nrequest.AddParameter(\"2\", \"b\");\nrequest.AddParameter(\"\\\"\\\"12\\\"\\\"\", \"\\\"23\\\"\");\nrequest.AddParameter(\"'1\\\"2\\\\\\\"\\\"3'\", \"'1\\\"23\\\"4'\");\nRestResponse response = await client.ExecuteAsync(request);\nConsole.WriteLine(response.Content);"
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"result": "var options = new RestClientOptions(\"https://postman-echo.com\")\n{\n\tMaxTimeout = -1,\n};\nvar client = new RestClient(options);\nvar request = new RestRequest(\"/post\", Method.Post);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nvar body = @\"{\" + \"\\n\" +\n@\" \"\"json\"\": \"\"Test-Test\"\"\" + \"\\n\" +\n@\"}\";\nrequest.AddStringBody(body, DataFormat.Json);\nRestResponse response = await client.ExecuteAsync(request);\nConsole.WriteLine(response.Content);"
"result": "var options = new RestClientOptions(\"https://postman-echo.com\")\n{\n\tTimeout = -1,\n};\nvar client = new RestClient(options);\nvar request = new RestRequest(\"/post\", Method.Post);\nrequest.AddHeader(\"Content-Type\", \"application/json\");\nvar body = @\"{\" + \"\\n\" +\n@\" \"\"json\"\": \"\"Test-Test\"\"\" + \"\\n\" +\n@\"}\";\nrequest.AddStringBody(body, DataFormat.Json);\nRestResponse response = await client.ExecuteAsync(request);\nConsole.WriteLine(response.Content);"
}

0 comments on commit cd18aae

Please sign in to comment.