private IResource ParseResponse(HttpRemoteResponse response) { if (response.StatusCode >= HttpStatusCode.BadRequest || response.HasNoContent() || !response.Headers.ContainsKey("Content-Type")) { return(new EmptyResource(response)); } string contentType = response.Headers["Content-Type"]; IResource resource = CreateResource(contentType, response); if (resource != null) { return(resource); } throw new InvalidOperationException("unsupported media type: " + response.Headers["Content-Type"]); }
protected bool ShouldRedirect(HttpRemoteResponse response) { return (int)response.StatusCode / 100 == 3 || ( response.StatusCode == HttpStatusCode.Created && response.HasNoContent()); }