gpt4 book ai didi

ruby-on-rails - Rails 事件资源 : how to send post parameters in the request body and not as query strings?

转载 作者:行者123 更新时间:2023-12-04 20:04:51 24 4
gpt4 key购买 nike

我正在使用 rails activeresource 调用一些 post 请求,但是所有参数都作为查询字符串发送,结果是被调用的 url 太长,我得到 WEBrick::HTTPStatus::RequestURITooLarge异常(exception)。

所以我需要在请求正文中发送参数,但是我找不到如何做到这一点。

非常感谢

最佳答案

要在 activeresource 中发送 post 请求,您应该引用 the documentation

例如你可以这样做

#Entity.post(custom_method_name, options = {}, body = '')
Company.post(:add_role, nil, {user_id: 1, role_id: 2}.to_json)

如果您还需要什么,请告诉我。

关于ruby-on-rails - Rails 事件资源 : how to send post parameters in the request body and not as query strings?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27018953/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com