谷歌安全浏览返回400个错误请求



Google返回400个错误请求;但是这个请求有什么问题吗?

open FSharp.Data
let apiKey = "key goes here - removed for stackoverflow"
let postUrl = "http://safebrowsing.clients.google.com/safebrowsing/downloads"
let testArray = "2nhttp://www.google.com/nhttp://ianfette.org/"
[<EntryPoint>]
let main argv = 
    let foo2 = Http.Request(postUrl, httpMethod = "Post",
        query   = [ "client", "api"; "apikey", apiKey; "appver", "1.0"; "pver", "2.2" ],
        body = TextRequest (testArray)
        )
    0

我已经通过成功执行get请求验证了我的密钥是正确的,只有post失败

当我更新FSharp。数据到2.0.5版本(2014-03-29发布)。我只能假设在之前的版本中有一个bug,现在已经修复了。

发布说明状态:

添加到默认缺失值列表中。重新添加了对在错误的情况下指定已知的HTTP标头。固定HTTP发送请求时,使用可移植的类库版本的FSharp。数据完整的。net版本。

下面是最终的(有效的)代码:

open FSharp.Data
let apiKey = "key goes here"
let postUrl = "https://sb-ssl.google.com/safebrowsing/api/lookup"
let testArray = "2nhttp://www.google.com/nhttp://ianfette.org/"
[<EntryPoint>]
let main argv = 
    let foo2 = Http.Request(postUrl, httpMethod = "Post",
        query   = [ "client", "api"; "apikey", apiKey; "appver", "1.5.2"; "pver", "3.0" ],
        body = TextRequest (testArray)
        )
    0

感谢Sergey Tihon在问题中找到了我的URL字符串中的错误。

最新更新