mirror of
https://github.com/vlang/v.git
synced 2025-08-03 17:57:59 -04:00
This commit is contained in:
parent
277e5eb253
commit
cc7665ff32
@ -1,13 +1,13 @@
|
||||
module main
|
||||
|
||||
import net.http { CommonHeader, Request, Response, Server }
|
||||
import net.http { Request, Response, Server }
|
||||
|
||||
struct ExampleHandler {}
|
||||
|
||||
fn (h ExampleHandler) handle(req Request) Response {
|
||||
mut res := Response{
|
||||
header: http.new_header_from_map({
|
||||
CommonHeader.content_type: 'text/plain'
|
||||
.content_type: 'text/plain'
|
||||
})
|
||||
}
|
||||
mut status_code := 200
|
||||
|
10
vlib/v/tests/enums/short_enum_syntax_across_module_test.v
Normal file
10
vlib/v/tests/enums/short_enum_syntax_across_module_test.v
Normal file
@ -0,0 +1,10 @@
|
||||
import net.http
|
||||
|
||||
fn test_short_enum_syntax_across_module() {
|
||||
header := http.new_header_from_map({
|
||||
.content_type: 'application/json'
|
||||
})
|
||||
|
||||
println(header)
|
||||
assert true
|
||||
}
|
@ -240,8 +240,8 @@ pub fn (mut ctx Context) send_response_to_client(mimetype string, res string) bo
|
||||
}
|
||||
// build the header after the potential modification of resp.body from above
|
||||
header := http.new_header_from_map({
|
||||
http.CommonHeader.content_type: mimetype
|
||||
http.CommonHeader.content_length: resp.body.len.str()
|
||||
.content_type: mimetype
|
||||
.content_length: resp.body.len.str()
|
||||
}).join(ctx.header)
|
||||
resp.header = header.join(headers_close)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user