1
I’m unable to consume the Github V3 API with basic authentication (without using Octokit). I know it works with Restsharp but I want to know why it doesn’t work with HttpClient
and HttpWebRequest
.
I always get the same answer :
"A protocol breach error occurred"
Just follow my code:
using (var client = new HttpClient())
{
var response = client.GetAsync("https://api.github.com/emojis").Result;
if (response.IsSuccessStatusCode)
{
var responseContent = response.Content;
string responseString = responseContent.ReadAsStringAsync().Result;
Console.WriteLine(responseString);
}
}
Thank you very much, I already use with async and await more was already testing everything without finding the problem, that was Header, only put the header that used and worked
– Mr.GMSOFT