Skip to content

Swagger does not respond with bad request and instead responds with 406 #2125

@VictorioBerra

Description

@VictorioBerra

Describe the bug

Generate a new template but set -xf to None (no XML formatters).

Launch Swagger, make a POST request to cars.

Change the JSON Model property to null.

Notice you get a 406, not a 400.

Steps to reproduce

Generate a new template but set -xf to None (no XML formatters).
Launch Swagger, make a POST request to cars.
Change the JSON Model property to null.
Notice you get a 406, not a 400.

Expected behaviour

You should get a 400 with helpful model state errors.

Template

API

.NET Boxed Version

Latest

Visual Studio Version

VS22

.NET Version

.NET 7

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssues describing a bug or pull requests fixing a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions