I am trying to do a simple POST request but for some reason my Integer parameter is null. This is something so basic, but I don't see what I am doing wrong here.
Here is what I have tried so far:
$rootScope.addUser = function(userId) {
$http.post('/addUser', {
params: {
user_id: userId
}
}).then(function(result) {
$rootScope.userId = undefined;
});
};
Controller
@PostMapping("/addUser")
public void addTournament(@RequestParam(required = false) final Integer userId) {
LOG.info("addUser: {}" , userId);
}
I have also tried doing @RequestParam(name = "user_id") final Integer userId, but even that does not work either!
In the end I will removed the 'required = false' parameter, but I left it there for now just to verify that the userId is indeed null.
The input is being grabbed from the user they input a number and click a button.