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

HEAD Optimization returns a 200 status code instead of 204

已关闭 适合新手
#8,647 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

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

调研方向

api-platform/core:定位 HEAD 优化标志的定义位置,以及 HEAD 请求在内容序列化之前被短路的位置 —— 在 src/ 树中 grep HEAD 优化选项以及处理 HEAD 方法的 listener 或 processor。确定在该路径上 200 状态码在哪里被设置,以及如何改为返回 204。完成标准是:启用优化的 HEAD 请求返回 204 且没有响应体,并由 tests/ 中覆盖该场景的先失败后通过的测试来验证;注意:报告者主动提出自己来开 PR,因此要先与 maintainers 确认。

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

描述

Hello,

We notice there is a flag for HEAD optimization which bypass content serialization.

For now, we have in our codebase a custom processor which does the same as your HEAD optimization flag.

When dropping our custom processor and trying to rely on the built-in flag, our tests notice a difference on the response status code.

Our processor returns a 204 but the API Platform implementation returns a 200.

Would you be ok to return a 204 in this situation instead of a 200 ?

If yes, I will open a PR with this change.

主要语言
PHP
星标
2.6k
派生
989
平均合并
1 天 23 小时
30 天内合并 PR
102

环境准备

从这里开始

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

api-platform/core 的其他 Issue

查看 api-platform/core 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

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