diff --git a/examples/http_server.v b/examples/http_server.v index 630fa20fd12e02..6ec7e4c2c7e0a0 100644 --- a/examples/http_server.v +++ b/examples/http_server.v @@ -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 diff --git a/vlib/v/tests/enums/short_enum_syntax_across_module_test.v b/vlib/v/tests/enums/short_enum_syntax_across_module_test.v new file mode 100644 index 00000000000000..c81a9dcd686dca --- /dev/null +++ b/vlib/v/tests/enums/short_enum_syntax_across_module_test.v @@ -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 +} diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index f440d2222aa4ab..9ae31ee2de5e07 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -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)