public HeadscopePrepare Update(string appKey, HeadScopeData headScopeData)
 {
     var clone = CloneData();
     clone.AppKey = appKey;
     clone.HeadScopeData = headScopeData;
     return clone;
 }
示例#2
0
        public HeadscopePrepare Update(string appKey, HeadScopeData headScopeData)
        {
            var clone = CloneData();

            clone.AppKey        = appKey;
            clone.HeadScopeData = headScopeData;
            return(clone);
        }
 public HttpRequestMessage BuildPOSTRequest(string appKey, HeadScopeData headscopeData)
 {
     var httpRequestMessage = new HttpRequestMessage
     {
         Method = HttpMethod.Post,
         RequestUri = new Uri(Target.OriginalString.Replace("{appKey}", appKey), UriKind.Relative),
         Content = headscopeData.ToHttpContent()
     };
     httpRequestMessage.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
     return httpRequestMessage;
 }
示例#4
0
        public HttpRequestMessage BuildPOSTRequest(string appKey, HeadScopeData headscopeData)
        {
            var httpRequestMessage = new HttpRequestMessage
            {
                Method     = HttpMethod.Post,
                RequestUri = new Uri(Target.OriginalString.Replace("{appKey}", appKey), UriKind.Relative),
                Content    = headscopeData.ToHttpContent()
            };

            httpRequestMessage.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            return(httpRequestMessage);
        }
        public HeadscopeResponse(HttpResponseMessage httpResponse)
        {
            _innerResponse["status"] = (int)httpResponse.StatusCode;
            var jheaders = new JObject();

            HeadScopeData.AddHeaders(httpResponse.Headers, jheaders);

            //NOTE: PHI ALERT - Need to be cautious if we were to send body
            if (httpResponse.Content != null)
            {
                HeadScopeData.AddHeaders((HttpHeaders)httpResponse.Content.Headers, jheaders);
                _innerResponse["body"] = (JToken)httpResponse.Content.ReadAsStringAsync().Result;
            }
            if (!Enumerable.Any <JProperty>(jheaders.Properties()))
            {
                return;
            }
            _innerResponse["headers"] = jheaders;
        }
示例#6
0
        public HeadscopeRequest(HttpRequestMessage httpRequest)
        {
            if (httpRequest.RequestUri == null)
            {
                throw new ArgumentException("Request Uri is required for a Headscope Request");
            }
            requestObject["method"] = httpRequest.Method.ToString();
            requestObject["url"]    = httpRequest.RequestUri.OriginalString;
            var jheaders = new JObject();

            HeadScopeData.AddHeaders(httpRequest.Headers, jheaders);
            if (httpRequest.Content != null)
            {
                HeadScopeData.AddHeaders(httpRequest.Content.Headers, jheaders);
                requestObject["body"] = httpRequest.Content.ReadAsStringAsync().Result;
            }
            if (!jheaders.Properties().Any())
            {
                return;
            }
            requestObject["headers"] = jheaders;
        }