How do I serve text/html #530
Unanswered
Jameswood-vega
asked this question in
Q&A
Replies: 1 comment
-
You probably shouldn't return plain HTML at all, but you can always set the Body to type GreetingOutput struct {
ContentType string `header:"Content-Type"`
Body []byte `example:"<h1>Hello, world!</h1>" doc:"Greeting message"`
} Then return the HTML as follows: resp := &GreetingOutput{}
resp.Body = []byte(fmt.Sprintf("<h1>Hello, %s!</h1>", input.Name))
resp.ContentType = "text/html"
return resp, nil |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello Daniel,
we have recently adopted huma at my current employer, and have had great success with a data api we have built.
I am trying to expand my understanding of how to use this framework, but I can't figure out how to get it to serve good old html content.
for example I have modified the greetings example to return basic html.
I expected this to work.
But I get
I have tried to figure it out on my own and I am stuck please help.
Beta Was this translation helpful? Give feedback.
All reactions