onyxframework / http

An opinionated framework for scalable web 🌎
https://onyxframework.com/http
MIT License
142 stars 11 forks source link

Add ignore_content_type option to json and form params #60

Closed vladfaust closed 5 years ago

vladfaust commented 5 years ago
  params do
    json(ignore_content_type: true) do
      type content : String
    end
  end

Will attempt to parse the JSON body regardless of the "Content-Type" header, but only the body is present. Would raise 400 on body type mismatch (i.e. when form is passed). Would raise 400 if body is absent and this param type is required (see #59).

It would be useful for single-content-type endpoints.