开发者

Submitting a ruby gem via the API fails with HTTP error code 422

I'm trying to upload my FAKE project (http://github.com/forki/FAKE) to RubyGems from F#:

let mutable rubyGems = "http://rubygems.org/api/v1/gems"

let PushGem gemFileName authCode = 
    let client = new System.Net.WebClient()
    client.Headers.Add(Net.HttpRequestHeader.Authorization,authCode)

    logfn "Uploading gem %s to %s." gemFileName rubyGems
    client.UploadFile(rubyGems,gemFileName)
      |> System.Text.Encoding.ASCII.GetString
      |> printfn "%s"

It returns: Uploading gem .\gems\fake-1.42.9.0.gem to http://rubygems.org/api/v1/g开发者_StackOverflow中文版ems. The remote server returned an error: (422) Unprocessable Entity.

The gem seems to be OK since I can install it. The API docs can be found at https://rubygems.org/pages/api_docs.

Any ideas?

Regards, Steffen

Update

curl --data-binary fake-1.42.11.0.gem -H 'Authorization:.....' http://rubygems.org/api/v1/gems

gives:

RubyGems.org cannot process this gem. Please try rebuilding itand installing it locally to make sure it's valid.

but gem push fake-1.42.11.0.gem seems to work.

Regards, Steffen


if submitting file with curl (as it given in api sample) works correctly? If yes - you should compare requests from curl and WebClient.UploadFile.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜