31 lines
1015 B
C#
31 lines
1015 B
C#
using System.Net;
|
|
using System.Text;
|
|
|
|
namespace FileServerTests;
|
|
|
|
public class UnitTest1 {
|
|
[Test]
|
|
public async Task TestMethod1() {
|
|
using var client = new HttpClient
|
|
{
|
|
DefaultRequestVersion = HttpVersion.Version30,
|
|
DefaultVersionPolicy = HttpVersionPolicy.RequestVersionExact,
|
|
};
|
|
|
|
// Console.WriteLine("--- 127.0.0.1:8090 ---");
|
|
|
|
// var resp = await client.GetAsync("https://127.0.0.1:8090/hello");
|
|
var resp = await client.GetAsync("https://api.hammer-hfut.tk:233/aics/file/hello");
|
|
var headers = new StringBuilder();
|
|
foreach (var (headerName, headerValues) in resp.Headers) {
|
|
headers.AppendLine($"{headerName}: {string.Join(", ", headerValues)}");
|
|
}
|
|
var body = await resp.Content.ReadAsStringAsync();
|
|
|
|
Console.WriteLine(
|
|
$"status: {resp.StatusCode}, version: {resp.Version}, \n" +
|
|
$"headers: \n{headers}\n" +
|
|
$"body: \n{body}"
|
|
);
|
|
}
|
|
} |