Ruby curl 命令工作时 rest-client 返回 401

Ruby rest-client returning 401 while curl command works

我有一个有效的 curl 命令,returns 正是我想要的,一堆 JSON:

curl -D- -u username:password -X GET -H "Content-Type: application/json" https://stash.address.net/rest/api/1.0/projects/FOOBAR/repos\?limit\=1000

我需要将其转换为RestClient::Request,但我仍然得到 401 返回:

RestClient::Request.execute(
    method: :get,
    headers: {
        content_type: 'application/json'
    },
    username: 'username',
    password: 'password',
    url: 'https://stash.address.net/rest/api/1.0/projects/FOOBAR/repos',
    params: {
        limit: '1000'
    },
    verify_ssl: false
)

我是不是忘记了什么?我的请求中是否缺少某些内容?是不是和上面的curl命令一模一样?

From the documentation 我没有看到任何关于 usernameparams 选项的提及。他们建议在 URL.

中插入值
RestClient.get 'https://username:password@stash.address.net/rest/api/1.0/projects/FOOBAR/repos', { accept: :json, params: { limit: 1000 }}