HTTP-API-PROBLEM
A library to create HTTP response content for APIs based on RFC7807.
Usage
Get the latest version for your Cargo.toml
from
crates.io.
Serde
HttpApiProblem
implements Serialize
and Deserialize
.
Examples
use *;
let p = with_title_and_type_from_status
.set_detail
.set_instance;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
There is also From<u16>
implemented for HttpStatusCode
:
use *;
let p = with_title_and_type_from_status
.set_detail
.set_instance;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Features
Web Frameworks
There are multiple features to integrate with web frameworks:
with_warp
with_hyper
with_warp
These mainly convert the HttpApiProblem
to response types of
the frameworks and implement traits to integrate with the frameworks
error handling
ApiError
The feature with_api_error
enables a structure which can be
return from "api handlers" that generate responses and can be
converted into an HttpApiProblem
.
Recent changes
-
0.15.0
- Warp support added
-
0.13.1
- Impl
std::error::Error
for HttpApiProblem
- Impl
-
0.13.0
- Temporarely disable rocket
- update actix to 1.0
- do not support
iron
any longer
-
0.12.0 Added experimental API Error type
-
0.11.0 Added
actix_web
support -
0.10.0 Use
http::StatusCode
Breaking change
Thank you
A big "thank you" for contributions and inspirations goes to the following GitHub users:
- panicbit
- thomaseizinger
License
http-api-problem
is primarily distributed under the terms of both the MIT
license and the Apache License (Version 2.0).
Copyright (c) 2017 Christian Douven.
License: Apache-2.0/MIT