C# HttpClient Bad Request on second call

Viewed 1863

I've found with the below code that on any second httpclient request, I always get a 400 Bad Request.

I can confirm the API calls actually work and return a 200 - so if I flip them, the first call will return 200 second call, 400.

I can't figure out why this is the case.

 using (HttpClient client = new HttpClient())
        {
            client.BaseAddress = new Uri(BaseUrl);
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));

            HttpResponseMessage blah = await client.GetAsync("api/subscriptions?account=eclipse&application=Sample");
            HttpResponseMessage dfds = await client.GetAsync("api/subscriptions?account=eclipse");
...
}
1 Answers
Related