Skip to content

Veb context.set_header not working as expected for .content-type #24016

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

Open
c-cesar opened this issue Mar 23, 2025 · 1 comment
Open

Veb context.set_header not working as expected for .content-type #24016

c-cesar opened this issue Mar 23, 2025 · 1 comment
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@c-cesar
Copy link

c-cesar commented Mar 23, 2025

Describe the bug

Setting the encoding with ctx.set_header(.content_type, 'text/html; charset=utf-8') results in only 'text/html' in the header.
Setting with ctx.content_type = 'text/html; charset=utf-8' works as expected.

Reproduction Steps

import veb
pub struct Context {
    veb.Context
}

pub struct App {
}

pub fn (app &App) page(mut ctx Context) veb.Result {
	ctx.set_header(.server, 'veb')
	ctx.set_header(.content_type, 'text/html; charset=utf-8')
	return ctx.text('Hello, World!')
}
fn main() {
	mut app := &App{}
	veb.run[App, Context](mut app,  8080)
}

Expected Behavior

Header
Content-Type: text/html; charset=utf-8

Current Behavior

Header
content-type: text/html

Possible Solution

No response

Additional Information/Context

No response

V version

0.4.10

Environment details (OS name and version, etc.)

Linux

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@c-cesar c-cesar added the Bug This tag is applied to issues which reports bugs. label Mar 23, 2025
Copy link

Connected to Huly®: V_0.6-22409

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

No branches or pull requests

1 participant