Skip to content

avgalex/MicroElements.FluentProxy

 
 

Repository files navigation

MicroElements.FluentProxy

Simple http proxy to use in front of real services. Use it for tracing blackboxes and for mocking responses.

WARNING: version before 1.0.0 has unstable API. After stabilizing this warning will be removed!

Statuses

License NuGetVersion NuGetDownloads MyGetVersion

Travis AppVeyor Coverage Status

Gitter

Installation

Package Reference:

dotnet add package MicroElements.FluentProxy

Usage

var settings = new FluentProxySettings
{
    ExternalUrl = new Uri("https://api.github.com"),
    OnRequestFinished = session =>
    {
        Console.WriteLine(session.RequestUrl);
        Console.WriteLine(session.ResponseData.ResponseContent);
    }
};
FluentProxyServer fluentProxyServer = await FluentProxyFactory.CreateServer(settings);

var request = new HttpRequestMessage(HttpMethod.Get, "/repos/aspnet/docs/branches");
request.Headers.Add("Accept", "application/vnd.github.v3+json");
request.Headers.Add("User-Agent", "HttpClientFactory-Sample");

HttpClient httpClient = fluentProxyServer.GetHttpClient();

var httpResponseMessage = await httpClient.SendAsync(request);
var response = await httpResponseMessage.Content.ReadAsStringAsync();

Build

Windows: Run build.ps1

Linux: Run build.sh

License

This project is licensed under the MIT license. See the LICENSE file for more info.

About

Simple http proxy to use in front of real services

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 86.2%
  • PowerShell 7.0%
  • Shell 6.8%