I don't understand optional parameters

https://fsprojects.github.io/FSharp.Data/reference/fsharp-data-http.html#Request
?body is optional, but i can not pass it as None. Why?
I want to make single call for GET and POST but it forbids me this.

It’s a bit confusing, but in this case, the arguments are “optional” more like in a C# sense, meaning that you don’t need to supply the parameter at all.

For example, here I only supply the url and the method:

let response = Http.Request(url = "www.somewebsite.com", httpMethod = "GET")

If you want to explicitly pass None you can prefix the parameter with a question mark:

let response = Http.Request(url = "www.somewebsite.com", httpMethod = "GET", ?query = None)

If you want to know more about Optional parameters, here are the docs :slight_smile:

3 Likes