Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BugFix #15: it was causing strange timeout issues to occur with subse…

…quent calls.
  • Loading branch information...
commit 36fed28a40fada40ffcfdff8d0b0b0a98d2ba71c 1 parent 56b7af6
@soitgoes authored
Showing with 14 additions and 8 deletions.
  1. +14 −8 LoveSeat/CouchClient.cs
View
22 LoveSeat/CouchClient.cs
@@ -166,15 +166,21 @@ public void DeleteAdminUser(string userToDelete)
/// </summary>
/// <param name="databaseName"></param>
/// <returns></returns>
- public bool HasDatabase(string databaseName)
- {
+ public bool HasDatabase(string databaseName) {
var request = GetRequest(baseUri + databaseName);
- request.Timeout = 5000;
- var result = request
- .Get()
- .GetResponse();
- return result.StatusCode == HttpStatusCode.OK;
- }
+ request.Timeout = -1;
+
+ var response = request.GetResponse();
+ var pDocResult = new Document(response.GetResponseString());
+
+ if (pDocResult["error"] == null) {
+ return (true);
+ }
+ if (pDocResult["error"].Value<String>() == "not_found") {
+ return (false);
+ }
+ throw new Exception(pDocResult["error"].Value<String>());
+ }
/// <summary>
/// Returns true/false depending on whether or not the user is contained in the _users database
Please sign in to comment.
Something went wrong with that request. Please try again.