.NET Fiddle

CSharp · Console

/Program.cs

using System;
using System.Collections.Generic;
using System.Net.Http;
					
public class Program
{
	public static void Main()
	{
		string url = "https://run.mocky.io/v3/afaaa084-a3d1-4d62-b23c-ffd4a76a1548"; //text/plain
		//string url = "https://run.mocky.io/v3/15e5bfec-bee8-4f44-8604-d86c9a71d3aa"; // application/json
		
		HttpClient client = new HttpClient();
		var requestMessage = new HttpRequestMessage(HttpMethod.Get, new Uri(url));
		var response = client.SendAsync(requestMessage).Result;
		
		var foo = response.Content.ReadAsAsync<Foo>(); //throw here since the response is in text/plain.
		Console.WriteLine("Success.");
	}
	
    class Foo { }
}
;