Skip to content

Return appropriate HTTP status code instead of 500 #261

@orhun

Description

@orhun

There are some cases where we return 500 instead of an appropriate HTTP status code. We should refactor them to make the API more idiomatic/conventional.

One example is from #258 (comment)

rustypaste/src/server.rs

Lines 954 to 955 in 4987cfe

assert_eq!(StatusCode::INTERNAL_SERVER_ERROR, response.status());
assert_body(response.into_body(), "file already exists\n").await?;

We should use 409 Conflict there instead of 500 internal server error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions