Skip to content

Conversation

@Deroino
Copy link

@Deroino Deroino commented Nov 24, 2025

while user try to delete log file , the ui 调用 createHeaders(),导致 DELETE 等无包体请求也被强制加上了 Content-Type: application/json。 Fastify 服务端在收到此头时会尝试解析 Body,面对空 Body 直接抛出 FST_ERR_CTP_EMPTY_JSON_BODY 错误。

修改后:仅在 options.body 存在时才添加 JSON Content-Type 头。
image

之前 apiFetch 无脑调用 createHeaders(),导致 DELETE 等无包体请求也被强制加上了 Content-Type: application/json。
Fastify 服务端在收到此头时会尝试解析 Body,面对空 Body 直接抛出 FST_ERR_CTP_EMPTY_JSON_BODY 错误。

修改后:仅在 options.body 存在时才添加 JSON Content-Type 头。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant