interagent / committee

A collection of Rack middleware to support JSON Schema.
MIT License
883 stars 135 forks source link

Check Content-Type header for OPTIONS requests #428

Closed Flixt closed 1 month ago

Flixt commented 2 months ago

We encountered a problem when a client made an OPTIONS request, because committee does only validate the content type header for POST, PUT and PATCH requests.

The OpenAPI (3) schema for the endpoint looks like this:

MySchema:
  type: object
  required:
  - document_id
  properties:
    document_id:
      type: integer

The client left out the Content-Type header and sent and empty request body which did not lead to an Committee::InvalidRequest error.