olsh/curl-to-csharp

Multiple endpoints results in only one being used

devlead opened this issue · 0 comments

Example, send two GETs:

curl http://url1.example.com http://url2.example.com 

Result

using (var httpClient = new HttpClient())
{
    using (var request = new HttpRequestMessage(new HttpMethod("GET"), "http://url1.example.com/"))
    {
        var response = await httpClient.SendAsync(request);
    }
}

Expect

2 requests. Probably a foreach around request statement.

Example, send two POSTs:

curl --data name=curl http://url1.example.com http://url2.example.com

Result

using (var httpClient = new HttpClient())
{
    using (var request = new HttpRequestMessage(new HttpMethod("POST"), "http://url1.example.com/"))
    {
        request.Content = new StringContent("name=curl", Encoding.UTF8, "application/x-www-form-urlencoded"); 

        var response = await httpClient.SendAsync(request);
    }
}

Exepected

2 requests