Skip to content

Commit 68cd02d

Browse files
committed
Fix add cookie throwing because of the empty domain
1 parent 68742be commit 68cd02d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/RestSharp/RestClientExtensions.Config.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,12 @@ public static RestClient UseQueryEncoder(this RestClient client, Func<string, En
4949
/// <param name="client"></param>
5050
/// <param name="name">Cookie name</param>
5151
/// <param name="value">Cookie value</param>
52+
/// <param name="path">Cookie path</param>
53+
/// <param name="domain">Cookie domain, must not be an empty string</param>
5254
/// <returns></returns>
53-
public static RestClient AddCookie(this RestClient client, string name, string value) {
55+
public static RestClient AddCookie(this RestClient client, string name, string value, string path, string domain) {
5456
lock (client.CookieContainer) {
55-
client.CookieContainer.Add(new Cookie(name, value));
57+
client.CookieContainer.Add(new Cookie(name, value, path, domain));
5658
}
5759

5860
return client;

0 commit comments

Comments
 (0)