public HttpClientAdapter CreateClient(PipelineOptions options) { var adapterOptions = new AdapterOptions { AutoRedirect = AutoRedirect.AutoRedirectButDoNotForwardAuthorizationHeader, CachePolicy = new CachePolicy {Cache = false}, AcceptEncoding = new AcceptEncoding {AcceptGzipAndDeflate = true} }; options.Use<AutoRedirect>(option => { adapterOptions.AutoRedirect = option; }); options.Use<CachePolicy>(option => { adapterOptions.CachePolicy = option; }); options.Use<AcceptEncoding>(option => { adapterOptions.AcceptEncoding = option; }); return CreateClient(adapterOptions); }
public HttpClientAdapter CreateClient(PipelineOptions options) { var redirectOption = AutoRedirect.AutoRedirectButDoNotForwardAuthorizationHeader; options.Use <AutoRedirect>(option => { redirectOption = option; }); return(Adapters[redirectOption]); }
public void ApplyToResponse(HttpResponseMessage response, PipelineOptions pipelineOptions) { StatusAcceptability acceptable = new ExpectStatusNotInRange(400, 599); pipelineOptions.Use <StatusAcceptability>(option => { acceptable = option; }); AssertResponseHasAcceptableStatus(response, acceptable); }
public HttpClientAdapter CreateClient(PipelineOptions options) { AutoRedirect redirectOption = null; options.Use<AutoRedirect>(option => { redirectOption = option; }); return new SystemNetHttpClientAdapter(redirectOption); }
public HttpClientAdapter CreateClient(PipelineOptions options) { var adapterOptions = new AdapterOptions { AutoRedirect = AutoRedirect.AutoRedirectButDoNotForwardAuthorizationHeader, CachePolicy = new CachePolicy { Cache = false }, AcceptEncoding = new AcceptEncoding { AcceptGzipAndDeflate = true } }; options.Use <AutoRedirect>(option => { adapterOptions.AutoRedirect = option; }); options.Use <CachePolicy>(option => { adapterOptions.CachePolicy = option; }); options.Use <AcceptEncoding>(option => { adapterOptions.AcceptEncoding = option; }); options.Use <RequestTimeout>(option => adapterOptions.Timeout = option); return(CreateClient(adapterOptions)); }
public void ApplyToResponse(HttpResponseMessage response, PipelineOptions pipelineOptions) { pipelineOptions.Use<ExpectResponseHeaders>(option => AssertResponseHeadersAreExpected(option, response.AllHeadersAsStrings())); }
public void ApplyToResponse(HttpResponseMessage response, PipelineOptions pipelineOptions) { StatusAcceptability acceptable = new ExpectStatusNotInRange(400, 599); pipelineOptions.Use<StatusAcceptability>(option => { acceptable = option; }); AssertResponseHasAcceptableStatus(response, acceptable); }
public void ApplyToResponse(HttpResponseMessage response, PipelineOptions pipelineOptions) { pipelineOptions.Use <ExpectResponseHeaders>(option => AssertResponseHeadersAreExpected(option, response.AllHeadersAsStrings())); }
public void ApplyToRequest(HttpRequestMessage request, PipelineOptions pipelineOptions) { pipelineOptions.Use<BasicAuth>(auth => AddAuthorizationHeader(request, auth.Username, auth.Password)); }
public void ApplyToRequest(HttpRequestMessage request, PipelineOptions pipelineOptions) { pipelineOptions.Use <BasicAuth>(auth => AddAuthorizationHeader(request, auth.Username, auth.Password)); }