当我使用以下代码时:
class LoginDto
{
public string Username { get; set; }
public string Password { get; set; }
}
public async void OnLogin()
{
var response = await HttpClient.PostAsJsonAsync("http://localhost:80/api/v1/login", new LoginDto { Username = "username", Password = "password" });
var result = await response.Content.ReadAsStringAsync();
}
提琴手显示客户端正在发送OPTIONS请求,而不是POST!谁能解释发生了什么事?