Optional file upload not working? #159
Answered
by
vearutop
yannickl88
asked this question in
Q&A
-
Hey, cool package, really love that if feels like a complete solution. I was messing around with some of the input definitions. However, I think it is not possible to have a optional file uploads. func Upload() usecase.Interactor {
type Input struct {
Upload *multipart.FileHeader `formData:"file"`
Url string `formData:"url"`
}
u := usecase.NewInteractor(func(ctx context.Context, input Input, output *string) error {
// ...
return nil
})
u.SetDescription("Upload a file or URL")
u.SetTags("Default")
return u
} None of the input fields are required, however, if I post something with only the {
"status": "INVALID_ARGUMENT",
"error": "invalid argument: failed to get file \"file\" from request: http: no such file"
} Am I missing something or did I hit a bug? |
Beta Was this translation helpful? Give feedback.
Answered by
vearutop
May 28, 2023
Replies: 1 comment 1 reply
-
Thank you for reporting this, indeed it is a bug (fixed in #160). |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
yannickl88
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for reporting this, indeed it is a bug (fixed in #160).