I have a simple below post method in Micronaut, which sends the image to the controller as shown below
@Controller("/product")
public class ProductController {
@Post(consumes = MediaType.MULTIPART_FORM_DATA, produces = MediaType.MULTIPART_FORM_DATA)
public String post(@Body MultipartBody file){
return "This is multipost";
}
}
How can I pass the value of file to the controller from the postman, curl or swagger?
I tried the below things
curl --location --request POST 'http://localhost:8080/product' \
--form 'file=@"/Users/macbook/Downloads/anand 001.jpg"'
I get the error as Required Body [file] not specified
. How do we pass the value?