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

[Lib/InnerBrowser] Send raw content in post body

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

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
48/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
php
领域
api

调研方向

从 src/Codeception/Lib/InnerBrowser.php 第 189 行附近开始,检查 sendAjaxPostRequest 如何验证和格式化其第二个参数。将文档中说明的数组行为与原始 JSON 和纯文本示例进行比较;当调用方可以发送原始内容,而不会被 http_build_query 转换时,即视为完成。

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

描述

What are you trying to achieve?

I am trying to call sendAjaxPostRequest and I would like to pass raw, unformatted parameters to the server.
For example

$I->sendAjaxPostRequest('/some-endpoint', '{"foo": "bar"}');
// or even
$I->sendAjaxPostRequest('/some-endpoint', 'hello, how do you do?')
What do you get instead?

I get an error saying that the second parameter of sendAjaxPostRequest must be of type array. This array then gets converted using http_build_query and there is no way to pass raw data. See https://github.com/Codeception/Codeception/blob/3.1/src/Codeception/Lib/InnerBrowser.php#L189

When passing an array, the array always gets converted to http query params format of foo=bar&example=codeception

I think an alternative approach could be to use REST Module, which I think can accept raw content (or at least properly json_encode body).

Is there something I am missing? How would you suggest to test this endpoint?

主要语言
PHP
星标
87
派生
20
PR 合并指标
30 天内没有已合并 PR

环境准备

我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

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

Codeception/lib-innerbrowser 的其他 Issue

查看 Codeception/lib-innerbrowser 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

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