public static void GetAndVerifyStatusCode(Workspace w, QueryNode query) { AstoriaRequest request = w.CreateRequest(query); AstoriaResponse response = request.GetResponse(); ResponseVerification.VerifyStatusCode(response); }
public static void GetAndVerifyStatusCode(Workspace w, string uri, HttpStatusCode expectedStatusCode, out AstoriaResponse response, WebHeaderCollection requestHeaders) { AstoriaRequest request = w.CreateRequest(); request.URI = uri; request.ExpectedStatusCode = expectedStatusCode; request.Accept = "*/*"; if (requestHeaders != null) { foreach (string header in requestHeaders.AllKeys) { request.Headers[header] = requestHeaders[header]; } } response = request.GetResponse(); try { ResponseVerification.VerifyStatusCode(response); } catch (Exception e) { ResponseVerification.LogFailure(response, e); } }
public BatchResponse(BatchRequest request, AstoriaResponse response) : base(request) { if (request.ExpectedStatusCode == HttpStatusCode.Accepted) { try { ResponseVerification.VerifyStatusCode(response); } catch (Exception e) { ResponseVerification.LogFailure(response, e); } } Responses = new List <AstoriaResponse>(); this.Headers = response.Headers; this.Payload = response.Payload; this.ETagHeaderFound = response.ETagHeaderFound; this.ActualStatusCode = response.ActualStatusCode; this.Exception = response.Exception; if (request.ExpectedStatusCode == HttpStatusCode.Accepted) { BatchReader.ParseBatchResponse(this); } }