-
-
Notifications
You must be signed in to change notification settings - Fork 233
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Hi there!
I have a problem about the request input which embed other structs that having RawBody as multipart.Form type causing panic error when make a request
The following input struct is unmarshalled successfully
type RequestHeader struct {
Test string `header:"Test"`
}
type GreetingInput struct {
RequestHeader
RawBody multipart.Form
}While this input struct got panic error reflect.Set: value of type multipart.Form is not assignable to type main.EmbedGreeting
type RequestHeader struct {
Test string `header:"Test"`
}
type EmbedGreeting struct {
RawBody multipart.Form
}
type AnotherGreetingInput struct {
RequestHeader
EmbedGreeting
}Both input are similarly used in the following handler
type GreetingOutput struct {
Body struct {
Message string `json:"message" example:"Hello, world!" doc:"Greeting message"`
}
}
huma.Get(api, "/greeting", func(ctx context.Context, input *GreetingInput) (*GreetingOutput, error) {
resp := &GreetingOutput{}
fmt.Println(fmt.Sprintf("Hello World %v %v", input.Test, input.RawBody.Value["Test"]))
resp.Body.Message = fmt.Sprintf("Hello World %v %v", input.Test, input.RawBody.Value["Test"])
return resp, nil
})Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working