Closed GitHubProUser67 closed 4 months ago
What are you passing in for ip, port, and command?
So, the system is this.
I pass in the server ip, port 10076, and the command which is a CRUD command.
BUT, I managed to fix the bug, if fact, server needs to be able to attribute default values for the method and content type:
Ideally it should default to GET / text/plain.
Sorry for the delay here, I can't reproduce this using the Test.Default
project and v6.1.9.
Your first example:
public static void Main(string[] args)
{
HttpResponseMessage resp = new HttpClient().GetAsync("http://localhost:8080/").Result;
Console.WriteLine(SerializationHelper.SerializeJson(resp, true));
}
Returns:
C:\Code\Misc\Sandbox\sandbox\bin\Debug\net8.0>sandbox
{
"Version": "1.1",
"Content": {
"Headers": [
{
"Key": "Content-Type",
"Value": [
"text/plain"
]
},
{
"Key": "Content-Length",
"Value": [
"13"
]
}
]
},
"StatusCode": "OK",
"ReasonPhrase": "OK",
"Headers": [
{
"Key": "Date",
"Value": [
"Sun, 30 Jun 2024 18:32:57 GMT"
]
},
{
"Key": "Connection",
"Value": [
"close"
]
},
{
"Key": "Access-Control-Allow-Origin",
"Value": [
"*"
]
},
{
"Key": "Access-Control-Allow-Methods",
"Value": [
"OPTIONS, HEAD, GET, PUT, POST, DELETE, PATCH"
]
},
{
"Key": "Access-Control-Allow-Headers",
"Value": [
"*"
]
},
{
"Key": "Access-Control-Expose-Headers",
"Value": [
""
]
},
{
"Key": "Accept",
"Value": [
"*/*"
]
},
{
"Key": "Accept-Language",
"Value": [
"en-US, en"
]
},
{
"Key": "Accept-Charset",
"Value": [
"ISO-8859-1, utf-8"
]
},
{
"Key": "Cache-Control",
"Value": [
"no-cache"
]
},
{
"Key": "Host",
"Value": [
"localhost:8080"
]
}
],
"TrailingHeaders": [],
"RequestMessage": {
"Version": "1.1",
"VersionPolicy": "RequestVersionOrLower",
"Method": {
"Method": "GET"
},
"RequestUri": "http://localhost:8080/",
"Headers": [],
"Properties": {},
"Options": {}
},
"IsSuccessStatusCode": true
}
Your second example:
string resp = new WebClient().DownloadStringTaskAsync("http://localhost:8080/").Result;
Console.WriteLine(resp);
Returns:
C:\Code\Misc\Sandbox\sandbox\bin\Debug\net8.0>sandbox
Default route
In Watson.Lite, using a stock configured C# downloader as this function does:
Will always return a internal server error on the server: