F# - Http.RequestString 错误 - CURL 和 PowerShell 正常

F# - Http.RequestString Error - CURL And PowerShell OK

我正在尝试使用 "F# Data Http Utilities" 访问远程服务但没有成功:

let account token = Http.RequestString("https://api.example.com/v1", 
                                       httpMethod = "POST",
                                       headers    = ["Accept", "application/json";
                                                     "Content-Type", "application/json"; 
                                                     "X-Application", "JRQ"; 
                                                     "X-Authentication", "MOl5C9ZZ";],
                                       body       = TextRequest """ {"jsonrpc": "2.0", "method": "getAccount"} """)

即使 curl 和 PowerShell 等价物都能正常工作:

curl -i -X POST \
   -H "Accept:application/json" \
   -H "Content-Type:application/json" \
   -H "X-Application:JRQ" \
   -H "X-Authentication:MOl5C9ZZ" \
   -d '{"jsonrpc": "2.0", "method": "getAccount"}' \
'https://api.example.com/v1'

我错过了什么?

原来的F#代码好像没有错误。设置以下 属性:

System.Net.ServicePointManager.Expect100Continue <- false;

问题解决了!