GET请求正常工作。
我正在使用omniauth-basecamp和restclient:
resource = RestClient::Resource.new(
'https://basecamp.com/27xxxxx/api/v1',
headers: {
user_agent: 'MyApp (me@example.com',
authorization: "Bearer #{my_token}",
content_type: "application/json"
}
)
resource['/projects/7213xxx/todos/129851xxx.json'].get # => 200 OK
resource['/projects/7213xxx/todos/129851xxx.json'].put(content: 'Hello!') # => 403 FORBIDDEN
答案 0 :(得分:0)
问题是有效负载没有被序列化为json,所以它是表单编码的。
payload = {content: 'Hello!!'}.to_json
resource['/projects/7213xxx/todos/129851xxx.json'].put(payload) # => 200 OK
想知道响应是否应该是Bad Request而不是Forbidden。