I know that we can map an object using _method(@RequestBody ObjectClass obj)
.
What i'm trying to achieve is _method(@RequestBody ObjectClass obj, @RequestBody OtherObjectClass obj2)
but doesn't work.
Is there some way to map two objects using same request?
Thanks!
A HTTP request is made up of headers and body. For a single request, you have a single request body, you can't have two. You can then parse the request body to extract different variables from it, for example if your request body is a JSON, then you can parse it and convert it into an object.
See this example, further on at section "Passing multiple json objects"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With