Compare commits

..
2 Commits
Author SHA1 Message Date
meiseayoung 8e1007a1b4 chore: update v.mod version 2025-12-30 18:42:02 +08:00
meiseayoung 6cdba50f36 fix: Remove duplicate response headers 2025-12-30 18:41:34 +08:00
2 changed files with 5 additions and 7 deletions
+4 -6
View File
@@ -229,14 +229,16 @@ fn send_picoev_response(mut res picohttpparser.Response, ctx Context, response h
mut has_content_type := false
mut has_connection := false
mut has_content_length := false
for key, value in ctx.headers {
// 跳过 Content-Length,picohttpparser 会在 body() 时自动添加
if key.to_lower() == 'content-length' {
continue
}
res.header(key, value)
key_lower := key.to_lower()
if key_lower == 'content-type' { has_content_type = true }
if key_lower == 'connection' { has_connection = true }
if key_lower == 'content-length' { has_content_length = true }
}
if content_type := response.header.get(.content_type) {
@@ -250,10 +252,6 @@ fn send_picoev_response(mut res picohttpparser.Response, ctx Context, response h
res.header('Content-Type', 'text/plain; charset=utf-8')
}
if !has_content_length {
res.header('Content-Length', response.body.len.str())
}
if !has_connection {
if keepalive {
res.header('Connection', 'keep-alive')
+1 -1
View File
@@ -1,7 +1,7 @@
Module {
name: 'hono'
description: 'A high-performance V language web framework inspired by Hono.js, featuring hybrid routing, LRU cache, middleware support, and more.'
version: '0.3.3'
version: '0.3.4'
license: 'MIT'
dependencies: []
}