protected override object Handle(object[] args, MemberAccessWrapper next)
 {
     return(new MemberAccessWrapper
            (
                next.HttpClientWrapper,
                next.BaseUri,
                next.GetRelativeUri() + "/" + args[0],
                next.Headers
            ));
 }
Esempio n. 2
0
        protected override object Handle(object[] args, MemberAccessWrapper next)
        {
            var queryString = ToQueryString(args[0].FlattenObjectToKeyValuePairs <string>(includeThisType: Object.IsValueTypeOrPrimitiveOrStringOrGuidOrDateTime));

            return(new MemberAccessWrapper
                   (
                       next.HttpClientWrapper,
                       next.BaseUri,
                       next.GetRelativeUri() + queryString,
                       next.Headers
                   ));
        }
        protected override object Handle(object[] args, MemberAccessWrapper next)
        {
            if (args[0] is IDictionary <string, string> headers)
            {
                AddHeaders(next, headers);
            }
            else
            {
                AddHeaders(next, new Headers(args[0]));
            }

            return(new MemberAccessWrapper
                   (
                       next.HttpClientWrapper,
                       next.BaseUri,
                       next.GetRelativeUri(),
                       next.Headers
                   ));
        }
        protected override object Handle(object[] args, MemberAccessWrapper next)
        {
            var headers = args[0] as IDictionary <string, string>;

            if (headers != null)
            {
                AddHeaders(next, headers);
            }
            else
            {
                AddHeaders(next, args[0].GetType().GetProperties()
                           .Where(_ => _.GetValue(args[0]) != null)
                           .ToDictionary(_ => FormatHeaderName(_.Name), _ => _.GetValue(args[0]).ToString()));
            }

            return(new MemberAccessWrapper
                   (
                       next.HttpClientWrapper,
                       next.BaseUri,
                       next.GetRelativeUri(),
                       next.Headers
                   ));
        }