public RunscopeResponse(HttpResponseMessage httpResponse) { _jResponse["status"] = (int)httpResponse.StatusCode; var jheaders = new JObject(); RunscopeMessage.AddHeaders(httpResponse.Headers, jheaders); if (httpResponse.Content != null) { RunscopeMessage.AddHeaders(httpResponse.Content.Headers, jheaders); _jResponse["body"] = httpResponse.Content.ReadAsStringAsync().Result; } if (jheaders.Properties().Any()) { _jResponse["headers"] = jheaders; } }
public RunscopeRequest(HttpRequestMessage httpRequest) { if (httpRequest.RequestUri == null) { throw new ArgumentException("Request Uri is required for a Runscope Request"); } _jRequest["method"] = httpRequest.Method.ToString(); _jRequest["url"] = httpRequest.RequestUri.OriginalString; var jheaders = new JObject(); RunscopeMessage.AddHeaders(httpRequest.Headers, jheaders); if (httpRequest.Content != null) { RunscopeMessage.AddHeaders(httpRequest.Content.Headers, jheaders); _jRequest["body"] = httpRequest.Content.ReadAsStringAsync().Result; } if (jheaders.Properties().Any()) { _jRequest["headers"] = jheaders; } }