2

Things I've checked:

  • The logs - there isn't anything that seems related to this particular error. It doesn't look like the controller method is even being entered. No exception is being thrown and there is no error logging.
  • The types of the properties in the object I'm sending. Another asker had the same error message when their POJO had primitive fields and the JSON had nulls for those fields. There are no unpopulated primitive fields in my JSON.
  • Changing the user-agent header to something that isn't Postman doesn't work.
  • The POJO has a parameterless constructor.
  • I serialized the POJO with the same Jackson version that the controller uses.
  • The JSON checks out as valid using several online tools, and none of the values are crazy.

Controller method signature:

    @RequestMapping(method=RequestMethod.POST)
@ResponseBody
public AddressResponse standardiseAndPersistLocations (@RequestBody AddressRequest address, @RequestParam(defaultValue = "false") boolean includeCounty,
        HttpServletRequest request, HttpServletResponse response)
  • Are you sure that you call correct URL? – Ivan Nov 02 '18 at 18:02
  • Yes, this is the correct URL. – user3242112 Nov 05 '18 at 15:24
  • Are you passing the Content-Length header to the controller? This exception can be thrown when you have are passing a structurally valid object to the controller which has a different length from that specified by the Content-Length header. This can happen especially if you have copied the request from elsewhere and changed the payload. I experienced it after copying the request from a browser request into Postman. To resolve this I had to not pass through the Content-Length header or make sure it specified the correct length. – Khetho Mtembo Jan 21 '20 at 10:01

0 Answers0