我正在制作一个经过身份验证的请求:
let url = "https://datafeeds.networkrail.co.uk/ntrod/CifFileAuthenticate?type=CIF_ALL_FULL_DAILY&day=toc-full"
let auth = "Basic " + (username + ":" + password |> Encoding.UTF8.GetBytes |> Convert.ToBase64String)
Http.Request(url, headers=["Authorization", auth])
Http.Request来自FSharp.Data
在已编译的F#应用程序上,它工作正常,但在F#interactive上运行时,发送的请求稍有不同,我收到此错误:
System.Net.WebException: The remote server returned an error: (403) Forbidden.
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
在fiddler下查看,该网址返回302重定向到https://nr-datafeed-cif.s3.amazonaws.com/CIF_ALL_FULL_DAILY%2Ftoc-full.json?...
但是在fsi下,后续请求转到https://nr-datafeed-cif.s3.amazonaws.com/CIF_ALL_FULL_DAILY/toc-full.json?...而是。