Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Can't access whole form parameter list during handler execution

未关闭
#442 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
clojure
领域
api, backend

调研方向

从 POST "/api/:variable" handler 示例和链接的 Stack Overflow 问题开始,然后追踪 Ring request body 在 handler 执行前在哪里被消费。完成的标准是确定并记录一种受支持的方式,以便在 handler 中访问完整的表单参数或原始 body。

由索引模型根据 Issue 内容生成。

描述

Library Version(s)

[org.clojure/clojure "1.10.1"]
[metosin/compojure-api "1.1.13"]
[ring/ring-core "1.8.0"]
[metosin/muuntaja "0.6.6"]
[metosin/ring-http-response "0.9.1"]

Problem

I want to get all form/body parameters (or body string) in my request. I've tested out many ways and I can't find any way to do it.
I added many details in this SO question: https://stackoverflow.com/questions/61206840/how-do-i-obtain-all-of-plain-post-form-parameters-in-compojure-api-sweet

I've registered an answer there first because I thought it's a problem of not being familiar with ring and compojure-api. But there is not so much people traffic. If you're interested in more details then read the SO question too.

Code (SO version contains longer one):

(POST "/api/:variable" req
       (println
                (:form-params req) ;; {}
                (:body-params req) ;; {}
                (:params req)      ;; {:variable asd}
                (:body req))       ;; #object[org.eclipse.jetty.server.HttpInputOverHTTP 0x32205a75 HttpInputOverHTTP@32205a75[c=0,q=0,[0]=null,s=EOF]]
       (ok))

As I understand the (:body req) is already consumed somewhere but I don't know where and I'd like to get the output of it.
I've read how restructuring works in Compojure api method but it only supports known keys.

主要语言
Clojure
星标
1.1k
派生
145
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

metosin/compojure-api 的其他 Issue

查看 metosin/compojure-api 的全部 Issue

相似的 Issue

更多 Clojure Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。