经过身份验证的http请求仅在FSI中失败

时间:2013-04-08 12:18:32

标签: f# fsi f#-data

我正在制作一个经过身份验证的请求:

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?...而是。

0 个答案:

没有答案