I have created a console application in which I'm making a simple GET request to the Stack Exchange API to fetch some comments. I'm using Flurl. This method is called from Main
private static async Task GetComments()
{
dynamic d = await "https://api.stackexchange.com/2.2/comments?page=1&pagesize=5&order=desc&min=1513468800&max=1513555200&sort=creation&site=stackoverflow"
.GetJsonAsync();
}
But, I get this error:
{"Unexpected character encountered while parsing value: \u001f. Path '', line 0, position 0."}
I have tried setting the headers like this with no luck.
dynamic d = await new Url("https://api.stackexchange.com/2.2/comments.....")
.WithHeader("Content-Encoding", "gzip")
.WithHeader("Accept-Encoding", "gzip")
.GetJsonAsync();
The URL does return proper JSON when I open it in the browser