Skip to content

HttpClassicServerResponse 内 Set-Cookie 逻辑缺失 #307

Closed

Description

@Mai-icy

问题摘要 / Issue Summary

HttpClassicServerResponse 设置的 Cookie 没有被正确写入响应头中的 Set-Cookie。
并且没有显示出设置Cookie的 path,secure等参数

版本信息 / Version Information

v3.5.1

浏览器 / Browser

Chrome

操作系统 / Operating System

Windows 11

发生了什么?/ What happened?

在处理响应时,我调用了
response.cookies().add(cookie);

之后,期望在最终的 HTTP 响应头中出现标准的
Set-Cookie: access-token=xxx; Path=/; HttpOnly
但在调试 response 对象或框架生成的 header 时,发现只出现了一个名为 Cookie 的 header,而不是 Set-Cookie。

期望的行为 / Expected Behavior

在返回给客户端的实际 HTTP 响应中,应该使用 Set-Cookie header 来下发 cookie。
并且Response中的每个Cookie都应该采用一个 Set-Cookie 的header并携带SetCookie特有的参数

重现步骤 / Steps to Reproduce

Cookie cookie = Cookie.builder()
    .name("access-token")
    .value("test")
    .httpOnly(true)
    .path("/")
    .build();
response.cookies().add(cookie);

在浏览器中查看Response的Header

Image

相关日志 / Relevant Logs

额外信息 / Additional Context

浏览器端的 cookie 设置遵循 HTTP 标准,必须通过 Set-Cookie header 才能生效。
如果框架内部仅把 Cookie 当作响应 header 发送,这是不符合 HTTP 协议的。

确认事项 / Confirmations

  • 我已经搜索了现有的issues,确认这不是重复问题
    I have searched existing issues and confirmed this is not a duplicate

  • 我已经阅读了项目文档和 FAQ
    I have read the project documentation and FAQ

  • 我提供的信息准确完整
    The information I provided is accurate and complete

  • 我愿意协助测试问题修复 (可选)
    I'm willing to help test the bug fix (optional)

Activity

  1. added theissue type on Sep 24, 2025
  2. changed the title [-]HttpClassicServerResponse Cookie 没有在响应头输出 Set-Cookie[/-] [+]HttpClassicServerResponse 内 Cookie 逻辑错误[/+] on Sep 24, 2025
  3. changed the title [-]HttpClassicServerResponse 内 Cookie 逻辑错误[/-] [+]HttpClassicServerResponse 内 Set-Cookie 逻辑缺失[/+] on Sep 26, 2025
  4. added
    in: fitIssues in FIT modules
    and removed on Oct 10, 2025
  5. added this to the 3.5.4 milestone on Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: fitIssues in FIT modulestype: bugA general bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions