Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api)!: only accept json content #831

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Aug 2, 2023

  1. fix(api)!: only accept json content

    1. Clients can not send urlencoded/multipart requests.
    BREAKING CHANGE: this means that eg an appengine request on the endpoint
    `interface_values_path  POST    /v1/:realm_name/devices/:device_id/interfaces/:interface/*path_token`
    
    which previously _could_ be successful with an urlencoded body of `data=2`
    will not be successful anymore.
    
    2. Remove `pass: ["*/*"]`
    From the [Plug.Parsers documentation](https://hexdocs.pm/plug/Plug.Parsers.html),
    "This plug will raise Plug.Parsers.UnsupportedMediaTypeError by default
    if the request cannot be parsed by any of the given types and the MIME
    type has not been explicitly accepted with the :pass option".
    
    I believe this to be the desired behavior, as the application should return
    error code 415 if it is not parsable by one of the specified parsers.
    
    Signed-off-by: Francesco Noacco <francesco.noacco@secomind.com>
    noaccOS committed Aug 2, 2023
    Configuration menu
    Copy the full SHA
    f3f4489 View commit details
    Browse the repository at this point in the history