public dynamic BuildResponse(HttpRequestMessage request, string url, string method)
        {
            _client = _client ?? ClientFactory();
            var response = _client.SendAsync(request).Result;

            // Content negotiation goes here...
            var bodyString = response.Content != null?response.Content.ReadAsStringAsync().Result : null;

            HttpBody body = bodyString != null?HttpBody.Deserialize(bodyString) : null;

            return(new HttpReply
            {
                Body = body,
                Response = response
            });
        }
Beispiel #2
0
        private bool YieldMember(string name, out object result)
        {
            object value;

            if (_hash.TryGetValue(name, out value))
            {
                var json = value.ToString();
                if (json.TrimStart(' ').StartsWith("{"))
                {
                    var nested = Converter.StringToHash(json);
                    result = new HttpBody(nested);
                    return(true);
                }
                result = json;
                return(_hash[name] == result);
            }
            result = Null;
            return(true);
        }