Reputation: 2135
I have the following method:
@Controller
public class InterfaceController extends MasterController
{
@PostMapping(value = "/interface")
@ResponseBody
public String incomingPost(@RequestParam Map<String, String> queryMap)
{
System.out.println("Map: " + new Gson().toJson(queryMap));
return "Raw string to return.";
}
}
When I make a POST request to /interface
, I get a successful 200 response with the dummy string I want to return with but the Map is not populated with my parameters:
Map: {}
Why?
Upvotes: 0
Views: 2029
Reputation: 110
@RequestParam works if you pass all your params as part of url.
If you are passing the data in request body, then you must use
@RequestBody Map<String, Object> queryMap
Upvotes: 1