I have an interceptor. Before entering my controller, I read the body of the request. The original request is not repeatable, so I decided to wrap it with contentcacheingrequestwrapper. However, when using @ requestbody KBD> to receive parameters, the back-end reported an error. The log is as follows:
Resolved [org.springframework.http.converter.HttpMessageNotReadableException: Required request body is missing
Front end response is
{
"timestamp": "2021-07-21T11:53:55.637+0000",
"status": 400,
"error": "Bad Request",
"message": "Required request body is missing: public java.lang.String com.example.demo.controller.HelloController.post(com.example.demo.model.PostVO,javax.servlet.http.HttpServletRequest)",
"path": "/post"
}
It’s wrong. I’ve wrapped it up to be repeatable. After Google, stackoverflow didn’t find a solution, but
I found a description here. It says that contentcacheingrequestwrapper doesn’t overload the getinputstream method of httpservletrequestwrapper. This method will be used when receiving parameters with requestbody, So instead of using the contentcaching requestwrapper, I rewritten the httpservletrequestwrapper myself
Read More:
- Error: required request body is missing, @ requestbody annotation usage
- TypeError: Failed to execute ‘fetch‘ on ‘Window‘: Request with GET/HEAD method cannot have body.
- TypeError: putText() missing required argument ‘text‘ (pos 2)
- IIS “Bad Request – Request Too Long. HTTP Error 400. The size of the request headers is too long.”
- configure: error: libpam required but missing
- Macro generated_ UCLASS_ Body () and generated_ Analysis of body ()
- Bad Request – Request Too Long. HTTP Error 400. The size of the request headers is too long
- XML tag has empty body less… (Ctrl+F1) Reports empty tag body. The validation works in XML / JSP
- Solve the problem of jdk8 after win7 is installed. Has value ‘1.8’, but ‘1.7’ is required
- Solve the problem that stdole32.tlb is missing when win7 Microsoft Office 2007 Pro Plus excel is opened
- Flask Request an extension before_request after_request errorhandler
- error: Microsoft Visual C++ 9.0 is required
- After Vue is packaged, a blank page appears, an error is reported in the resource request, and there is no error handling scheme
- Version 1.8.0_201 of the JVM is not suitable for this product. Version: 11 or greater is required.
- [nodejs] error request aborted after request routing in post mode
- Nginx modifies the front end request size limit (413 request entity too large)
- Cannot find module ‘request’ is prompted after electron is packaged
- Cannot find module ‘body-parser’
- [problem solving] property[ elasticsearch.version ] is missing for plugin [head]
- Allegro’s solution to “symbol is missing a refdes”