Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add a test for short enum syntax across modules (related #12183) #22210

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/http_server.v
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 10 additions & 0 deletions vlib/v/tests/enums/short_enum_syntax_across_module_test.v
Original file line number Diff line number Diff line change
@@ -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
}
4 changes: 2 additions & 2 deletions vlib/vweb/vweb.v
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Loading