Skip to content

Restore 2-param AddCookie(name, value) overload#2351

Merged
alexeyzimarev merged 2 commits intodevfrom
feature/restore-addcookie-2param-overload
Feb 26, 2026
Merged

Restore 2-param AddCookie(name, value) overload#2351
alexeyzimarev merged 2 commits intodevfrom
feature/restore-addcookie-2param-overload

Conversation

@alexeyzimarev
Copy link
Member

Summary

  • Restores the simple AddCookie(name, value) overload that was removed in PR Move Cookie handling out of HttpClient so we do not cross pollinate requests #1966 when cookies were refactored to use CookieContainer
  • The 2-param form defers domain resolution to execution time by using CookieContainer.Add(Uri, Cookie), which infers the domain from the request URL
  • Adds a _cookies pending list to RestRequest (following the existing _files pattern) with pending cookies resolved in ExecuteRequestAsync before building headers
  • Updates cookie documentation across all doc versions to show both the simple and explicit 4-param forms
  • Fixes Cookes typo → Cookies in docs

Test plan

  • Existing CookieTests pass across all 4 target frameworks (net10.0, net9.0, net8.0, net48)
  • Verify AddCookie("name", "value") sends cookie with domain inferred from URL
  • Verify AddCookie("name", "value", "/", "domain") still works as before

Closes #2284

🤖 Generated with Claude Code

PR #1966 replaced the simple AddCookie(name, value) with a 4-param
overload requiring domain upfront, breaking the public API. This
restores the 2-param form by deferring domain resolution to execution
time using CookieContainer.Add(Uri, Cookie).

- Add _cookies pending list and PendingCookies accessor to RestRequest
- Add AddCookie(name, value) extension that stores cookies for deferred
  resolution alongside the existing 4-param AddCookie overload
- Resolve pending cookies at execution time in RestClient.Async.cs
  using the request URL to infer domain
- Update cookie documentation across all doc versions to show both forms
- Fix Cookes typo in docs

Closes #2284

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@qodo-free-for-open-source-projects
Copy link
Contributor

Review Summary by Qodo

Restore 2-param AddCookie overload and fix documentation

✨ Enhancement 📝 Documentation

Grey Divider

Walkthroughs

Description
• Restore 2-parameter AddCookie(name, value) overload for backward compatibility
• Defer domain resolution to execution time using CookieContainer.Add(Uri, Cookie)
• Add pending cookies list to RestRequest following existing _files pattern
• Update documentation across all versions with both simple and explicit forms
• Fix Cookes typo to Cookies in documentation
Diagram
flowchart LR
  A["AddCookie(name, value)"] --> B["Create Cookie object"]
  B --> C["Store in _cookies list"]
  C --> D["ExecuteRequestAsync"]
  D --> E["Resolve domain from URL"]
  E --> F["Add to CookieContainer"]
  G["AddCookie(name, value, path, domain)"] --> F
Loading

Grey Divider

File Changes

1. src/RestSharp/Request/RestRequest.cs ✨ Enhancement +6/-1

Add pending cookies list and accessors

• Add _cookies pending list field to store cookies for deferred resolution
• Add internal AddCookie(Cookie) method to add cookies to pending list
• Add PendingCookies property to expose pending cookies for execution

src/RestSharp/Request/RestRequest.cs


2. src/RestSharp/Request/RestRequestExtensions.cs ✨ Enhancement +9/-0

Restore 2-param AddCookie overload

• Add new 2-parameter AddCookie(string name, string value) overload
• Defer domain resolution to execution time by creating Cookie without domain
• Add XML documentation explaining domain inference from request URL

src/RestSharp/Request/RestRequestExtensions.cs


3. src/RestSharp/RestClient.Async.cs ✨ Enhancement +4/-0

Resolve pending cookies at execution time

• Resolve pending cookies before building request headers in ExecuteRequestAsync
• Add each pending cookie to CookieContainer using request URL for domain inference
• Maintain compatibility with existing 4-parameter cookie method

src/RestSharp/RestClient.Async.cs


View more (5)
4. docs/docs/usage/request.md 📝 Documentation +8/-2

Document both AddCookie overloads and fix typo

• Add example of 4-parameter AddCookie overload with explicit path and domain
• Clarify that 2-parameter form defers domain resolution to execution time
• Fix Cookes typo to Cookies
• Simplify cookie container explanation by removing questionable usage note

docs/docs/usage/request.md


5. docs/versioned_docs/version-v110/usage/usage.md 📝 Documentation +8/-2

Document both AddCookie overloads and fix typo

• Add example of 4-parameter AddCookie overload with explicit path and domain
• Clarify that 2-parameter form defers domain resolution to execution time
• Fix Cookes typo to Cookies
• Simplify cookie container explanation by removing questionable usage note

docs/versioned_docs/version-v110/usage/usage.md


6. docs/versioned_docs/version-v111/usage/request.md 📝 Documentation +8/-2

Document both AddCookie overloads and fix typo

• Add example of 4-parameter AddCookie overload with explicit path and domain
• Clarify that 2-parameter form defers domain resolution to execution time
• Fix Cookes typo to Cookies
• Simplify cookie container explanation by removing questionable usage note

docs/versioned_docs/version-v111/usage/request.md


7. docs/versioned_docs/version-v112/usage/request.md 📝 Documentation +8/-2

Document both AddCookie overloads and fix typo

• Add example of 4-parameter AddCookie overload with explicit path and domain
• Clarify that 2-parameter form defers domain resolution to execution time
• Fix Cookes typo to Cookies
• Simplify cookie container explanation by removing questionable usage note

docs/versioned_docs/version-v112/usage/request.md


8. docs/versioned_docs/version-v113/usage/request.md 📝 Documentation +8/-2

Document both AddCookie overloads and fix typo

• Add example of 4-parameter AddCookie overload with explicit path and domain
• Clarify that 2-parameter form defers domain resolution to execution time
• Fix Cookes typo to Cookies
• Simplify cookie container explanation by removing questionable usage note

docs/versioned_docs/version-v113/usage/request.md


Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Contributor

qodo-free-for-open-source-projects bot commented Feb 26, 2026

Code Review by Qodo

🐞 Bugs (3) 📘 Rule violations (1) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Pending cookies lack error handling📘 Rule violation ⛯ Reliability
Description
cookieContainer.Add(url, cookie) can throw (for example CookieException) and currently happens
outside the existing request try/catch, so a bad cookie can crash request execution. This violates
the requirement to handle failure points and edge cases gracefully.
Code

src/RestSharp/RestClient.Async.cs[R133-135]

+        foreach (var cookie in request.PendingCookies) {
+            cookieContainer.Add(url, cookie);
+        }
Evidence
PR Compliance ID 3 requires identifying and handling failure points and edge cases. The new
pending-cookie loop adds cookies to the container without any exception handling, while similar
cookie handling elsewhere explicitly catches CookieException to avoid failing requests.

Rule 3: Generic: Robust Error Handling and Edge Case Management
src/RestSharp/RestClient.Async.cs[130-135]
src/RestSharp/Extensions/CookieContainerExtensions.cs[19-27]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`ExecuteRequestAsync` applies `request.PendingCookies` via `cookieContainer.Add(url, cookie)` without any exception handling, and this code runs outside the existing `try/catch` that wraps `HttpClient.SendAsync`. Invalid cookies (or unexpected nulls) can throw (e.g., `CookieException`) and crash the request.
## Issue Context
There is already precedent in the codebase for not failing the request when cookie parsing fails (see `CookieContainerExtensions.AddCookies` which catches `CookieException`). Pending cookies should be handled with similar robustness.
## Fix Focus Areas
- src/RestSharp/RestClient.Async.cs[130-136]
- src/RestSharp/Extensions/CookieContainerExtensions.cs[19-27]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Cookies hidden from hooks🐞 Bug ✓ Correctness
Description
AddCookie(name,value) stores cookies in an internal pending list and only resolves them into
CookieContainer after request interceptors and authenticators run. Custom
interceptors/authenticators that read request.CookieContainer (or otherwise expect request cookies
to be part of request state) will not see these cookies and may misbehave (eg signing/auth decisions
made without cookies).
Code

src/RestSharp/RestClient.Async.cs[R130-135]

       // Make sure we have a cookie container if not provided in the request
       var cookieContainer = request.CookieContainer ??= new();

+        foreach (var cookie in request.PendingCookies) {
+            cookieContainer.Add(url, cookie);
+        }
Evidence
The new 2-param overload adds cookies to an internal list, not the CookieContainer.
ExecuteRequestAsync runs request interceptors (BeforeRequest) and request/client authenticator
before transferring PendingCookies into the CookieContainer, so those hooks cannot observe cookies
added via the new overload.

src/RestSharp/Request/RestRequestExtensions.cs[127-147]
src/RestSharp/Request/RestRequest.cs[266-270]
src/RestSharp/RestClient.Async.cs[103-110]
src/RestSharp/RestClient.Async.cs[130-135]
src/RestSharp/Interceptors/Interceptor.cs[28-40]
src/RestSharp/Authenticators/IAuthenticator.cs[17-19]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`AddCookie(name, value)` stores cookies in an internal pending list and only moves them into `request.CookieContainer` late in `ExecuteRequestAsync`, after request interceptors (`BeforeRequest`) and `IAuthenticator.Authenticate` have already run. This makes those cookies invisible to hook code that needs to read request cookies.
### Issue Context
- The 4-parameter overload populates `request.CookieContainer` immediately; the new 2-parameter overload does not.
- Interceptors/authenticators operate on `RestRequest` and can reasonably expect request cookies to be part of observable request state.
### Fix Focus Areas
- src/RestSharp/Request/RestRequestExtensions.cs[127-148]
- src/RestSharp/Request/RestRequest.cs[75-76]
- src/RestSharp/Request/RestRequest.cs[266-270]
- src/RestSharp/RestClient.Async.cs[130-135]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Pending cookies never cleared🐞 Bug ⛯ Reliability
Description
PendingCookies are transferred into the request CookieContainer on every execution, but the pending
list is never cleared or marked as resolved. If a RestRequest is re-executed (or retried), the same
Cookie objects will be re-added repeatedly, causing avoidable overhead and potential re-add edge
cases.
Code

src/RestSharp/Request/RestRequest.cs[R268-270]

+    internal RestRequest AddCookie(Cookie cookie) => this.With(x => x._cookies.Add(cookie));
+
+    internal IReadOnlyList<Cookie> PendingCookies => _cookies;
Evidence
The PR introduces a persistent _cookies list on RestRequest and enumerates it during execution to
add cookies into CookieContainer. There is no subsequent clearing of the list after transfer, so
repeated executions will repeat the transfer work. The docs and code also indicate the same request
instance may be sent multiple times (Attempts).

src/RestSharp/Request/RestRequest.cs[75-76]
src/RestSharp/Request/RestRequest.cs[266-270]
src/RestSharp/RestClient.Async.cs[130-135]
src/RestSharp/Response/RestResponseBase.cs[29-33]
docs/docs/advanced/configuration.md[212-224]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`PendingCookies` are added to `request.CookieContainer` during execution but the pending list is never cleared. Re-executing the same `RestRequest` (or retry flows) will repeat the add loop unnecessarily.
### Issue Context
Once cookies are added to `request.CookieContainer`, they will already be available for `AddCookieHeaders(...)` in future executions, so the pending list is redundant.
### Fix Focus Areas
- src/RestSharp/RestClient.Async.cs[130-135]
- src/RestSharp/Request/RestRequest.cs[75-76]
- src/RestSharp/Request/RestRequest.cs[266-270]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Advisory comments

4. CookieContainer docs inaccurate🐞 Bug ✓ Correctness
Description
The usage docs imply that calling AddCookie creates the request CookieContainer, but the new
2-parameter overload does not set CookieContainer until execution time. This can mislead users who
check request.CookieContainer immediately after calling AddCookie(name,value).
Code

docs/docs/usage/request.md[R230-240]

+The simple two-parameter form defers domain resolution until execution time — the cookie domain is inferred from the request URL. If you need to specify the path and domain explicitly, use the four-parameter overload:
+
+```csharp
+request.AddCookie("foo", "bar", "/path", "example.com");
+```
+
RestSharp will add cookies from the request as cookie headers and then extract the matching cookies from the response. You can observe and extract response cookies using the `RestResponse.Cookies` properties, which has the `CookieCollection` type.

-However, the usage of a default URL segment parameter is questionable as you can just include the parameter value to the base URL of the client. There is, however, a `CookieContainer` instance on the request level. You can either assign the pre-populated container to `request.CookieContainer`, or let the container be created by the request when you call `AddCookie`. Still, the container is only used to extract all the cookies from it and create cookie headers for the request instead of using the container directly. It's because the cookie container is normally configured on the `HttpClientHandler` level and cookies are shared between requests made by the same client. In most of the cases this behaviour can be harmful.
+There is a `CookieContainer` instance on the request level. You can either assign the pre-populated container to `request.CookieContainer`, or let the container be created by the request when you call `AddCookie`. The container is used to extract all the cookies from it and create cookie headers for the request instead of using the container directly. It's because the cookie container is normally configured on the `HttpClientHandler` level and cookies are shared between requests made by the same client. In most of the cases this behaviour can be harmful.

-If your use case requires sharing cookies between requests made by the client instance, you can use the client-level `CookieContainer`, which you must provide as the options' property. You can add cookies to the container using the container API. No response cookies, however, would be auto-added to the container, but you can do it in code by getting cookies from the `Cookes` property of the response and adding them to the client-level container available via `IRestClient.Options.CookieContainer` property.
+If your use case requires sharing cookies between requests made by the client instance, you can use the client-level `CookieContainer`, which you must provide as the options' property. You can add cookies to the container using the container API. No response cookies, however, would be auto-added to the container, but you can do it in code by getting cookies from the `Cookies` property of the response and adding them to the client-level container available via `IRestClient.Options.CookieContainer` property.
Evidence
The docs state the request-level CookieContainer can be created “when you call AddCookie”, but the
new 2-param overload only stages a cookie internally and does not assign CookieContainer (unlike the
4-param overload). CookieContainer is only created during ExecuteRequestAsync via
request.CookieContainer ??= new().

docs/docs/usage/request.md[230-240]
src/RestSharp/Request/RestRequestExtensions.cs[127-147]
src/RestSharp/RestClient.Async.cs[130-132]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Docs currently suggest the request `CookieContainer` is created when calling `AddCookie`, but the new 2-parameter overload does not assign `CookieContainer` until request execution.
### Issue Context
This is primarily a documentation clarity issue to prevent confusion when users inspect `request.CookieContainer` right after calling `AddCookie(name, value)`.
### Fix Focus Areas
- docs/docs/usage/request.md[230-240]
- docs/versioned_docs/version-v110/usage/usage.md[233-243]
- docs/versioned_docs/version-v111/usage/request.md[211-221]
- docs/versioned_docs/version-v112/usage/request.md[230-240]
- docs/versioned_docs/version-v113/usage/request.md[230-240]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 26, 2026

Deploying restsharp with  Cloudflare Pages  Cloudflare Pages

Latest commit: 38c5e32
Status: ✅  Deploy successful!
Preview URL: https://fe50fb40.restsharp.pages.dev
Branch Preview URL: https://feature-restore-addcookie-2p.restsharp.pages.dev

View logs

@qodo-free-for-open-source-projects
Copy link
Contributor

CI Feedback 🧐

A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

Action: test-linux (net10.0)

Failed stage: Upload Test Results [❌]

Failure summary:

The workflow did not fail due to build or test failures (all test suites reported Failed: 0); it
failed during the artifact upload step.
- The step actions/upload-artifact@v6 errored when trying to
create the artifact: Failed to CreateArtifact: Unable to make request: ETIMEDOUT (log line 302).
-
This indicates a network connectivity/timeout issue reaching GitHub’s artifact service/endpoints
(transient GitHub outage, blocked egress, proxy/firewall/VPN/DNS issues, or runner network
instability).
- The NU1904/CS8604 messages shown earlier are warnings and did not stop the
build/tests.

Relevant error logs:
1:  ##[group]Runner Image Provisioner
2:  Hosted Compute Agent
...

172:  /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Shared/RestSharp.Tests.Shared.csproj : warning NU1904: Package 'Microsoft.AspNetCore.Server.Kestrel.Core' 2.2.0 has a known critical severity vulnerability, https://github.com/advisories/GHSA-5rrx-jjjq-q2r5 [/home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests/RestSharp.Tests.csproj]
173:  /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests/RestSharp.Tests.csproj : warning NU1904: Package 'Microsoft.AspNetCore.Server.Kestrel.Core' 2.2.0 has a known critical severity vulnerability, https://github.com/advisories/GHSA-5rrx-jjjq-q2r5
174:  Restored /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Shared/RestSharp.Tests.Shared.csproj (in 7.31 sec).
175:  Restored /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests/RestSharp.Tests.csproj (in 7.31 sec).
176:  /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests/RestSharp.Tests.csproj : warning NU1904: Package 'Microsoft.AspNetCore.Server.Kestrel.Core' 2.2.0 has a known critical severity vulnerability, https://github.com/advisories/GHSA-5rrx-jjjq-q2r5 [TargetFramework=net10.0]
177:  /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Shared/RestSharp.Tests.Shared.csproj : warning NU1904: Package 'Microsoft.AspNetCore.Server.Kestrel.Core' 2.2.0 has a known critical severity vulnerability, https://github.com/advisories/GHSA-5rrx-jjjq-q2r5 [TargetFramework=net10.0]
178:  SourceGenerator -> /home/runner/work/RestSharp/RestSharp/gen/SourceGenerator/bin/Debug/netstandard2.0/SourceGenerator.dll
179:  RestSharp -> /home/runner/work/RestSharp/RestSharp/src/RestSharp/bin/Debug/net10.0/RestSharp.dll
180:  RestSharp.Tests.Shared -> /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Shared/bin/Debug/net10.0/RestSharp.Tests.Shared.dll
181:  RestSharp.Tests -> /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests/bin/Debug/net10.0/RestSharp.Tests.dll
182:  Test run for /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests/bin/Debug/net10.0/RestSharp.Tests.dll (.NETCoreApp,Version=v10.0)
183:  VSTest version 18.0.1 (x64)
184:  Starting test execution, please wait...
185:  A total of 1 test files matched the specified pattern.
186:  Results File: /home/runner/work/RestSharp/RestSharp/test-results/net10.0/RestSharp.Tests.trx
187:  Passed!  - Failed:     0, Passed:   236, Skipped:     0, Total:   236, Duration: 2 s - RestSharp.Tests.dll (net10.0)
188:  Determining projects to restore...
...

199:  ##[warning]/home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.Xml/XmlDeserializer.cs(193,61): warning CS8604: Possible null reference argument for parameter 'value' in 'object? ReflectionExtensions.FindEnumValue(Type type, string value, CultureInfo culture)'. [/home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.Xml/RestSharp.Serializers.Xml.csproj::TargetFramework=net10.0]
200:  ##[warning]/home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.Xml/XmlDeserializer.cs(198,35): warning CS8604: Possible null reference argument for parameter 'uriString' in 'Uri.Uri(string uriString, UriKind uriKind)'. [/home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.Xml/RestSharp.Serializers.Xml.csproj::TargetFramework=net10.0]
201:  ##[warning]/home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.Xml/XmlDeserializer.cs(207,43): warning CS8604: Possible null reference argument for parameter 's' in 'DateTime DateTime.ParseExact(string s, string format, IFormatProvider? provider)'. [/home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.Xml/RestSharp.Serializers.Xml.csproj::TargetFramework=net10.0]
202:  ##[warning]/home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.Xml/XmlDeserializer.cs(208,38): warning CS8604: Possible null reference argument for parameter 's' in 'DateTime DateTime.Parse(string s, IFormatProvider? provider)'. [/home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.Xml/RestSharp.Serializers.Xml.csproj::TargetFramework=net10.0]
203:  ##[warning]/home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.Xml/XmlDeserializer.cs(235,39): warning CS8604: Possible null reference argument for parameter 's' in 'decimal decimal.Parse(string s, IFormatProvider? provider)'. [/home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.Xml/RestSharp.Serializers.Xml.csproj::TargetFramework=net10.0]
204:  ##[warning]/home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.Xml/XmlDeserializer.cs(241,70): warning CS8604: Possible null reference argument for parameter 'g' in 'Guid.Guid(string g)'. [/home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.Xml/RestSharp.Serializers.Xml.csproj::TargetFramework=net10.0]
205:  ##[warning]/home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.Xml/XmlDeserializer.cs(246,54): warning CS8604: Possible null reference argument for parameter 's' in 'TimeSpan XmlConvert.ToTimeSpan(string s)'. [/home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.Xml/RestSharp.Serializers.Xml.csproj::TargetFramework=net10.0]
206:  ##[warning]/home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.Xml/XmlDeserializer.cs(288,38): warning CS8604: Possible null reference argument for parameter 'inputString' in 'bool XmlDeserializer.TryGetFromString(string inputString, out object? result, Type type)'. [/home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.Xml/RestSharp.Serializers.Xml.csproj::TargetFramework=net10.0]
207:  RestSharp.Serializers.Xml -> /home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.Xml/bin/Debug/net10.0/RestSharp.Serializers.Xml.dll
208:  RestSharp.Tests.Integrated -> /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Integrated/bin/Debug/net10.0/RestSharp.Tests.Integrated.dll
209:  Test run for /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Integrated/bin/Debug/net10.0/RestSharp.Tests.Integrated.dll (.NETCoreApp,Version=v10.0)
210:  VSTest version 18.0.1 (x64)
211:  Starting test execution, please wait...
212:  A total of 1 test files matched the specified pattern.
213:  Results File: /home/runner/work/RestSharp/RestSharp/test-results/net10.0/RestSharp.Tests.Integrated.trx
214:  Passed!  - Failed:     0, Passed:   117, Skipped:     0, Total:   117, Duration: 1 m 40 s - RestSharp.Tests.Integrated.dll (net10.0)
215:  Determining projects to restore...
...

218:  Restored /home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.NewtonsoftJson/RestSharp.Serializers.NewtonsoftJson.csproj (in 575 ms).
219:  Restored /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Serializers.Json/RestSharp.Tests.Serializers.Json.csproj (in 792 ms).
220:  3 of 5 projects are up-to-date for restore.
221:  /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Serializers.Json/RestSharp.Tests.Serializers.Json.csproj : warning NU1904: Package 'Microsoft.AspNetCore.Server.Kestrel.Core' 2.2.0 has a known critical severity vulnerability, https://github.com/advisories/GHSA-5rrx-jjjq-q2r5 [TargetFramework=net10.0]
222:  /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Shared/RestSharp.Tests.Shared.csproj : warning NU1904: Package 'Microsoft.AspNetCore.Server.Kestrel.Core' 2.2.0 has a known critical severity vulnerability, https://github.com/advisories/GHSA-5rrx-jjjq-q2r5 [TargetFramework=net10.0]
223:  SourceGenerator -> /home/runner/work/RestSharp/RestSharp/gen/SourceGenerator/bin/Debug/netstandard2.0/SourceGenerator.dll
224:  RestSharp -> /home/runner/work/RestSharp/RestSharp/src/RestSharp/bin/Debug/net10.0/RestSharp.dll
225:  RestSharp.Tests.Shared -> /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Shared/bin/Debug/net10.0/RestSharp.Tests.Shared.dll
226:  RestSharp.Serializers.NewtonsoftJson -> /home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.NewtonsoftJson/bin/Debug/net10.0/RestSharp.Serializers.NewtonsoftJson.dll
227:  RestSharp.Tests.Serializers.Json -> /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Serializers.Json/bin/Debug/net10.0/RestSharp.Tests.Serializers.Json.dll
228:  Test run for /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Serializers.Json/bin/Debug/net10.0/RestSharp.Tests.Serializers.Json.dll (.NETCoreApp,Version=v10.0)
229:  VSTest version 18.0.1 (x64)
230:  Starting test execution, please wait...
231:  A total of 1 test files matched the specified pattern.
232:  Results File: /home/runner/work/RestSharp/RestSharp/test-results/net10.0/RestSharp.Tests.Serializers.Json.trx
233:  Passed!  - Failed:     0, Passed:    12, Skipped:     0, Total:    12, Duration: 592 ms - RestSharp.Tests.Serializers.Json.dll (net10.0)
234:  Determining projects to restore...
235:  Restored /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Serializers.Xml/RestSharp.Tests.Serializers.Xml.csproj (in 375 ms).
236:  3 of 4 projects are up-to-date for restore.
237:  SourceGenerator -> /home/runner/work/RestSharp/RestSharp/gen/SourceGenerator/bin/Debug/netstandard2.0/SourceGenerator.dll
238:  RestSharp -> /home/runner/work/RestSharp/RestSharp/src/RestSharp/bin/Debug/net10.0/RestSharp.dll
239:  RestSharp.Serializers.Xml -> /home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.Xml/bin/Debug/net10.0/RestSharp.Serializers.Xml.dll
240:  RestSharp.Tests.Serializers.Xml -> /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Serializers.Xml/bin/Debug/net10.0/RestSharp.Tests.Serializers.Xml.dll
241:  Test run for /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Serializers.Xml/bin/Debug/net10.0/RestSharp.Tests.Serializers.Xml.dll (.NETCoreApp,Version=v10.0)
242:  VSTest version 18.0.1 (x64)
243:  Starting test execution, please wait...
244:  A total of 1 test files matched the specified pattern.
245:  Results File: /home/runner/work/RestSharp/RestSharp/test-results/net10.0/RestSharp.Tests.Serializers.Xml.trx
246:  Passed!  - Failed:     0, Passed:   111, Skipped:     0, Total:   111, Duration: 147 ms - RestSharp.Tests.Serializers.Xml.dll (net10.0)
247:  Determining projects to restore...
...

250:  Restored /home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.CsvHelper/RestSharp.Serializers.CsvHelper.csproj (in 833 ms).
251:  Restored /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Serializers.Csv/RestSharp.Tests.Serializers.Csv.csproj (in 998 ms).
252:  3 of 5 projects are up-to-date for restore.
253:  /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Serializers.Csv/RestSharp.Tests.Serializers.Csv.csproj : warning NU1904: Package 'Microsoft.AspNetCore.Server.Kestrel.Core' 2.2.0 has a known critical severity vulnerability, https://github.com/advisories/GHSA-5rrx-jjjq-q2r5 [TargetFramework=net10.0]
254:  /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Shared/RestSharp.Tests.Shared.csproj : warning NU1904: Package 'Microsoft.AspNetCore.Server.Kestrel.Core' 2.2.0 has a known critical severity vulnerability, https://github.com/advisories/GHSA-5rrx-jjjq-q2r5 [TargetFramework=net10.0]
255:  SourceGenerator -> /home/runner/work/RestSharp/RestSharp/gen/SourceGenerator/bin/Debug/netstandard2.0/SourceGenerator.dll
256:  RestSharp -> /home/runner/work/RestSharp/RestSharp/src/RestSharp/bin/Debug/net10.0/RestSharp.dll
257:  RestSharp.Tests.Shared -> /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Shared/bin/Debug/net10.0/RestSharp.Tests.Shared.dll
258:  RestSharp.Serializers.CsvHelper -> /home/runner/work/RestSharp/RestSharp/src/RestSharp.Serializers.CsvHelper/bin/Debug/net10.0/RestSharp.Serializers.CsvHelper.dll
259:  RestSharp.Tests.Serializers.Csv -> /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Serializers.Csv/bin/Debug/net10.0/RestSharp.Tests.Serializers.Csv.dll
260:  Test run for /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Serializers.Csv/bin/Debug/net10.0/RestSharp.Tests.Serializers.Csv.dll (.NETCoreApp,Version=v10.0)
261:  VSTest version 18.0.1 (x64)
262:  Starting test execution, please wait...
263:  A total of 1 test files matched the specified pattern.
264:  Results File: /home/runner/work/RestSharp/RestSharp/test-results/net10.0/RestSharp.Tests.Serializers.Csv.trx
265:  Passed!  - Failed:     0, Passed:     6, Skipped:     0, Total:     6, Duration: 600 ms - RestSharp.Tests.Serializers.Csv.dll (net10.0)
266:  Determining projects to restore...
...

269:  Restored /home/runner/work/RestSharp/RestSharp/src/RestSharp.Extensions.DependencyInjection/RestSharp.Extensions.DependencyInjection.csproj (in 1.11 sec).
270:  Restored /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.DependencyInjection/RestSharp.Tests.DependencyInjection.csproj (in 1.23 sec).
271:  3 of 5 projects are up-to-date for restore.
272:  /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.DependencyInjection/RestSharp.Tests.DependencyInjection.csproj : warning NU1904: Package 'Microsoft.AspNetCore.Server.Kestrel.Core' 2.2.0 has a known critical severity vulnerability, https://github.com/advisories/GHSA-5rrx-jjjq-q2r5 [TargetFramework=net10.0]
273:  /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Shared/RestSharp.Tests.Shared.csproj : warning NU1904: Package 'Microsoft.AspNetCore.Server.Kestrel.Core' 2.2.0 has a known critical severity vulnerability, https://github.com/advisories/GHSA-5rrx-jjjq-q2r5 [TargetFramework=net10.0]
274:  SourceGenerator -> /home/runner/work/RestSharp/RestSharp/gen/SourceGenerator/bin/Debug/netstandard2.0/SourceGenerator.dll
275:  RestSharp -> /home/runner/work/RestSharp/RestSharp/src/RestSharp/bin/Debug/net10.0/RestSharp.dll
276:  RestSharp.Tests.Shared -> /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.Shared/bin/Debug/net10.0/RestSharp.Tests.Shared.dll
277:  RestSharp.Extensions.DependencyInjection -> /home/runner/work/RestSharp/RestSharp/src/RestSharp.Extensions.DependencyInjection/bin/Debug/net10.0/RestSharp.Extensions.DependencyInjection.dll
278:  RestSharp.Tests.DependencyInjection -> /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.DependencyInjection/bin/Debug/net10.0/RestSharp.Tests.DependencyInjection.dll
279:  Test run for /home/runner/work/RestSharp/RestSharp/test/RestSharp.Tests.DependencyInjection/bin/Debug/net10.0/RestSharp.Tests.DependencyInjection.dll (.NETCoreApp,Version=v10.0)
280:  VSTest version 18.0.1 (x64)
281:  Starting test execution, please wait...
282:  A total of 1 test files matched the specified pattern.
283:  Results File: /home/runner/work/RestSharp/RestSharp/test-results/net10.0/RestSharp.Tests.DependencyInjection.trx
284:  Passed!  - Failed:     0, Passed:    21, Skipped:     0, Total:    21, Duration: 548 ms - RestSharp.Tests.DependencyInjection.dll (net10.0)
285:  ##[group]Run actions/upload-artifact@v6
...

287:  name: Test Results Ubuntu net10.0
288:  path: test-results/**/*.xml
289:  test-results/**/*.trx
290:  test-results/**/*.json
291:  
292:  if-no-files-found: warn
293:  compression-level: 6
294:  overwrite: false
295:  include-hidden-files: false
296:  env:
297:  DOTNET_ROOT: /usr/share/dotnet
298:  ##[endgroup]
299:  With the provided path, there will be 6 files uploaded
300:  Artifact name is valid!
301:  Root directory input is valid!
302:  ##[error]Failed to CreateArtifact: Unable to make request: ETIMEDOUT
303:  If you are using self-hosted runners, please make sure your runner has access to all GitHub endpoints: https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners#communication-between-self-hosted-runners-and-github

@github-actions
Copy link

Test Results

   26 files     26 suites   13m 22s ⏱️
  503 tests   503 ✅ 0 💤 0 ❌
2 365 runs  2 365 ✅ 0 💤 0 ❌

Results for commit 9c040c2.

- Wrap cookieContainer.Add in try/catch for CookieException, matching
  the existing pattern in CookieContainerExtensions.AddCookies
- Clear pending cookies after transfer to avoid duplicate adds on
  request retry/reuse
- Make PendingCookies public so BeforeRequest interceptors and
  authenticators can observe cookies added via the 2-param overload
- Clarify docs: 4-param AddCookie populates CookieContainer immediately,
  2-param stores in PendingCookies until execution

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link

@alexeyzimarev alexeyzimarev merged commit 4511fab into dev Feb 26, 2026
10 of 11 checks passed
@alexeyzimarev alexeyzimarev deleted the feature/restore-addcookie-2param-overload branch February 26, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doc & API mismatch

1 participant