Permalink
Browse files

Merge pull request #48 from NorthNick/master

No Authorization header if username is null
  • Loading branch information...
2 parents ffb39d3 + 6c235a1 commit 5dbed2c1388718d13d2619f6042b3f9f3ec5a623 @soitgoes committed Jul 21, 2013
Showing with 9 additions and 6 deletions.
  1. +9 −6 LoveSeat/Support/CouchRequest.cs
@@ -49,15 +49,18 @@ public CouchRequest(string uri)
request.Headers.Clear(); //important
// Deal with Authorization Header
- string authValue = "Basic ";
- string userNAndPassword = username + ":" + password;
+ if (username != null) {
+ string authValue = "Basic ";
+ string userNAndPassword = username + ":" + password;
- // Base64 encode
- string b64 = System.Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(userNAndPassword));
+ // Base64 encode
+ string b64 = System.Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(userNAndPassword));
- authValue = authValue + b64;
+ authValue = authValue + b64;
+
+ request.Headers.Add("Authorization", authValue);
+ }
- request.Headers.Add("Authorization", authValue);
request.Headers.Add("Accept-Charset", "utf-8");
request.Headers.Add("Accept-Language", "en-us");
request.Referer = uri;

0 comments on commit 5dbed2c

Please sign in to comment.