I struggle with assigning values to an 'HttpRequestMessage' class. My code is:
let requestMsg = new HttpRequestMessage()
requestMsg.RequestUri = new System.Uri("https://yh-finance.p.rapidapi.com/stock/v2/get-summary?symbol=BMW.DE®ion=DE");;
When I assign the URL, I get the response:
val it : bool = false
I tried to assign a different Method but also got the same response.
> requestMsg.Method = HttpMethod.Post;;
val it : bool = false
requestMsg
has this content:
> 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;}
How can I modify the HttpRequestMessage
object?
Assignment in F# is done with <-
: https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/values/#mutable-variables
requestMsg.Method <- HttpMethod.Post