JSON Content-Type with Charset Is Rejected
Level 1 · node · API · Content-Type validation error
Scenario
A profile-note update API accepts JSON requests only. Requests with `Content-Type: application/json` work, but some standard HTTP clients send `application/json; charset=utf-8`, causing the same JSON body to be rejected with 415. The controller calls the service only after a media-type checker accepts the request, and rejected requests must not change repository state.
Requirements
- An application/json request updates the note and returns 200 - JSON media types remain accepted when parameters such as charset are present - Media-type comparison is unaffected by case differences or surrounding whitespace - A non-JSON media type such as text/plain is rejected with 415 - A rejected request must not change the stored profile note
Acceptance criteria
- An application/json request succeeds and stores the note
- An application/json; charset=utf-8 request also succeeds
- A JSON Content-Type with different case and whitespace also succeeds
- A text/plain request is rejected with 415
- The previous note remains unchanged after an unsupported Content-Type request