first commit

This commit is contained in:
yangshangbo
2025-04-10 18:14:01 +08:00
commit 8b18de9693
26 changed files with 270858 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
module hono
import net.http
pub struct Response {
}
pub fn Response.json(body string) http.Response {
return http.Response{
header: http.new_header(http.HeaderConfig{
key: http.CommonHeader.content_type
value: 'application/json'
})
status_code: 200
body: body
}
}
pub fn Response.text(body string) http.Response {
return http.Response{
header: http.new_header(http.HeaderConfig{
key: http.CommonHeader.content_type
value: 'plain/text'
})
status_code: 200
body: body
}
}
pub fn Response.html(body string) http.Response {
return http.Response{
header: http.new_header(http.HeaderConfig{
key: http.CommonHeader.content_type
value: 'text/html'
})
status_code: 200
body: body
}
}