private static HttpResponse ConvertResponse(HttpResponse<string> stringResponse) { return new HttpStringResponse { Headers = stringResponse.Headers, RawBody = stringResponse.Raw, Body = stringResponse.Body, StatusCode = stringResponse.Code }; }
private static HttpResponse ConvertResponse(HttpResponse<Stream> binaryResponse) { return new HttpResponse { Headers = binaryResponse.Headers, RawBody = binaryResponse.Body, StatusCode = binaryResponse.Code }; }
/// <summary> /// Validates the response against HTTP errors defined at the API level /// </summary> /// <param name="_response">The response recieved</param> /// <param name="_context">Context of the request and the recieved response</param> internal void ValidateResponse(HttpResponse _response, HttpContext _context) { if ((_response.StatusCode < 200) || (_response.StatusCode > 206)) //[200,206] = HTTP OK throw new APIException(@"HTTP Response Not OK", _context); }