Reputation: 11
Please solve the above error on the below code; Please help me.
mockMvc.perform(post("/bookings/").contentType(MediaType.APPLICATION_JSON)
.content(json).header("Authorization", "Bearer " + jwtString)).andExpect(status().isCreated()).andReturn();
Upvotes: 1
Views: 3912
Reputation: 15908
Generally 400 is Bad Request error it means the request you are sending is not proper which is expected by server.
So here the json is not proper so ensure that your json contains all the keys which are present in server side pojo class along with their type.
For troubleshoot in server side just ensure that controller method signature is all good like accepting json request and method type etc.
Upvotes: 0