如何为 HttpRequestMessage class 分配值?
How to assign the values for an HttpRequestMessage class?
我很难为 'HttpRequestMessage' class 赋值。
我的代码是:
let requestMsg = new HttpRequestMessage()
requestMsg.RequestUri = new System.Uri("https://yh-finance.p.rapidapi.com/stock/v2/get-summary?symbol=BMW.DE®ion=DE");;
当我分配 URL 时,我得到响应:
val it : bool = false
我尝试分配不同的方法,但也得到了相同的响应。
> requestMsg.Method = HttpMethod.Post;;
val it : bool = false
requestMsg
有这个内容:
> requestMsg;;
val it : HttpRequestMessage =
Method: GET, RequestUri: '<null>', Version: 1.1, Content: <null>, Headers:
{
}
{Content = null;
Headers = seq [];
Method = GET;
Options = seq [];
Properties = seq [];
RequestUri = null;
Version = 1.1;
VersionPolicy = RequestVersionOrLower;}
如何修改 HttpRequestMessage
对象?
F# 中的赋值是通过 <-
完成的:https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/values/#mutable-variables
requestMsg.Method <- HttpMethod.Post
我很难为 'HttpRequestMessage' class 赋值。 我的代码是:
let requestMsg = new HttpRequestMessage()
requestMsg.RequestUri = new System.Uri("https://yh-finance.p.rapidapi.com/stock/v2/get-summary?symbol=BMW.DE®ion=DE");;
当我分配 URL 时,我得到响应:
val it : bool = false
我尝试分配不同的方法,但也得到了相同的响应。
> requestMsg.Method = HttpMethod.Post;;
val it : bool = false
requestMsg
有这个内容:
> requestMsg;;
val it : HttpRequestMessage =
Method: GET, RequestUri: '<null>', Version: 1.1, Content: <null>, Headers:
{
}
{Content = null;
Headers = seq [];
Method = GET;
Options = seq [];
Properties = seq [];
RequestUri = null;
Version = 1.1;
VersionPolicy = RequestVersionOrLower;}
如何修改 HttpRequestMessage
对象?
F# 中的赋值是通过 <-
完成的:https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/values/#mutable-variables
requestMsg.Method <- HttpMethod.Post