I tried to connect to a HTTPS page. In C# i can write a line that asks C# to connect to HTTPS easily with the line
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
How do I adapt this to f#?
open System.Net
open System.IO
let url = "https://..."
let mutable request = HttpWebRequest.Create(url)
request.Method <- "GET"
request.ContentType <- "multipart/form-data"
ServicePointManager.ServerCertificateValidationCallback = fun -> true ????
let mutable resp = request.GetResponse()
let fn =
for i = 1 to 10 do
request <- WebRequest.Create(url)
resp <- request.GetResponse()
The following works too:
RemoteCertificateValidationCallback has the following signature:
Since pattern matching occurs for function arguments, and you’re ignoring all four parameters, you can substitute the wildcard pattern (underscore) for each, which is an idiomatic way to indicate a parameter is unused.