I am using .net 6.0 minimal api with the below simple code in c#
app.MapGet("/", () =>
{
return $"{{\"error\":\"0\", \"message\":\"\", \"rows\":\"0\", \"data\":\"It is working !\"}}";
});
My client side code in c# is as below
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
//
HttpClient httpClient = new HttpClient();
httpClient.BaseAddress = new Uri($"{(Properties.Settings.Default.use_https ? "https://" : "http://")}{Properties.Settings.Default.server_address}:Properties.Settings.Default.server_port}/");
HttpResponseMessage response = await httpClient.GetAsync("");
the response.Content is
{System.Net.Http.StreamContent}
Headers: {Content-Type: text/plain; charset=utf-8
}
IsBuffered: true
bufferSize: 4096
bufferedContent: {System.Net.Http.HttpContent.LimitMemoryStream}
canCalculateLength: false
content: {System.Net.Http.HttpClientHandler.WebExceptionWrapperStream}
contentConsumed: true
contentReadStream: null
disposed: false
headers: {Content-Type: text/plain; charset=utf-8
}
start: 0
With postman I am getting a proper result i.e. {"error":"0", "message":"", "rows":"0", "data":"It is working !"} from get of http://localhost:5400/
Maybe it is something to do with 'content: {System.Net.Http.HttpClientHandler.WebExceptionWrapperStream}'? How do I resolve this?