Skip to content

API option handling #2758

@sebgie

Description

@sebgie

Refs #2187

In our current implementation wrong or misused options are removed and the request is carried out without the options. This behavior makes our lives a bit easier in regards to error handling but invalid values for valid options should not be accepted and return 400 Bad Request.

Request parameters that are not supported at all could be ignored as most other web applications do.

Example:

Request: GET /ghost/api/v0.1/posts/?status=green
Result: 400, 'green is an invalid status'

Request: GET /ghost/api/v0.1/posts/?test=true
Result: same result as GET /ghost/api/v0.1/posts/

For internal API requests a new error class (InvalidOptionError) could be introduced.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions