Ejemplo n.º 1
0
        Response makeRequest(HttpOptions httpOptions)
        {
            var request = _requestBuilder.Build(httpOptions);

            var response = (HttpWebResponse) request.GetResponse();

            return _responseBuilder.Build(response);
        }
Ejemplo n.º 2
0
        public static void http(this object extended, Action<IHttp> configuration)
        {
            if (configuration == null) return;

            var http = new HttpOptions();

            configuration(http);

            HttpOptions.Cache[extended] = http;
        }
Ejemplo n.º 3
0
        void Action(HttpWebRequest request, HttpOptions options)
        {
            request.Method = "post";

            using (TextWriter writer = new StreamWriter(request.GetRequestStream()))
            {
                var json = _jsonSerializer.ToJson(options.AdditionalOptions.query);
                writer.Write(json);
            }
        }
Ejemplo n.º 4
0
        Response GetResponse(HttpOptions httpOptions, Action<HttpWebRequest> action = null)
        {
            var request = _requestBuilder.Build(httpOptions);

            if (action != null)
                action(request);

            var response = (HttpWebResponse) request.GetResponse();

            return _responseBuilder.Build(response);
        }
Ejemplo n.º 5
0
 internal Response Post(HttpOptions httpOptions)
 {
     httpOptions.Method = "post";
     return makeRequest(httpOptions);
 }
Ejemplo n.º 6
0
 internal Response Get(HttpOptions options)
 {
     options.Method = "get";
     return makeRequest(options);
 }
Ejemplo n.º 7
0
 internal Response Get(HttpOptions options)
 {
     return GetResponse(options);
 }
Ejemplo n.º 8
0
 internal Response Post(HttpOptions httpOptions)
 {
     return GetResponse(httpOptions, r => Action(r, httpOptions));
 }
Ejemplo n.º 9
0
 public Response Get(string url)
 {
     var httpOptions = new HttpOptions {BaseUri = url};
     return GetResponse(httpOptions);
 }
Ejemplo n.º 10
0
 internal Response Post(HttpOptions httpOptions)
 {
     httpOptions.Method = "post";
     return(makeRequest(httpOptions));
 }
Ejemplo n.º 11
0
 internal Response Get(HttpOptions options)
 {
     options.Method = "get";
     return(makeRequest(options));
 }
Ejemplo n.º 12
0
 internal static Response post(HttpOptions options)
 {
     return _requestor.Post(options);
 }
Ejemplo n.º 13
0
 internal static Response get(HttpOptions httpOptions)
 {
     return _requestor.Get(httpOptions);
 }