79730140

Date: 2025-08-08 18:45:33
Score: 0.5
Natty:
Report link

When the @RequestBody is added, Spring would require the content type to be application/json and the JSON body is required.
When the @RequestPart is added, Spring would require the content type to be multipart/form-data and input as form
=> If both of them are included in a controller, the error 403 will be thrown because the content type is not correct.

In this case, I think we can input username and email as @RequestPart
@RequestPart("username") String username

Reasons:
  • Has code block (-0.5):
  • Starts with a question (0.5): When theis add
  • Low reputation (0.5):
Posted by: minh tri Vo