clojure - 如何使用 GET 请求传递数据?
问题描述
我想通过 GET 请求传递表单数据。
我在这个卷曲上取得了成功:
curl http://sample.com -d 'action=login_request&user_name=balvan'
但我需要从-d
. 使用此函数调用:
(http-client/request
{:url base-url
:method :get
:deadlock-guard? false
:insecure? true})
如何在请求正文中添加那些“-d”参数?
我有[org.httpkit.client :as http-client]
ns 声明和[cheshire "5.8.1"]
项目的依赖项。
解决方案
发布man curl
告诉我们 -d 标志将发送带有数据的发布请求。
-d, --data <data>
(HTTP) Sends the specified data in a POST request to the HTTP
cause curl to pass the data to the server using the content-type
-d, --data is the same as --data-ascii. --data-raw is almost the
ter...
你想做的是:
(http-client/request
{:url base-url
:method :post
:form-params {"action" "login_request"
"user_name" "balvan"}
:deadlock-guard? false
:insecure? true})
推荐阅读
- go - proto.Marshal 内存不足
- javascript - 为 WebGL 纹理加载图像但由于 CORS 而失败
- android - 高级搜索栏崩溃
- javascript - 在我的数组中推送许多对象会擦除数组中所有以前的对象(React with Hooks)
- php - 无论如何在谷歌浏览器中自动将维基百科链接更改为 wiki-zero?
- ruby-on-rails - 创建一个 simple_form,它将由邮件程序在 rails 中自动发送
- matlab - Matlab中的样本t检验
- javascript - 当我长按键盘上的一个键时,事件输入错误页面
- android - 如何确保广播接收器保持运行并侦听传入的文本消息而不会被操作系统杀死
- javascript - 在 Javascript 循环中添加 2 个延迟