feignhttp 0.6.1

Declarative HTTP client for rust
Documentation
# FeignHTTP

[![crates.io](https://img.shields.io/crates/v/feignhttp.svg)](https://crates.io/crates/feignhttp)
[![Documentation](https://docs.rs/feignhttp/badge.svg)](https://docs.rs/feignhttp)
[![MIT licensed](https://img.shields.io/github/license/dxx/feignhttp.svg?color=blue)](./LICENSE)
[![CI](https://github.com/dxx/feignhttp/workflows/CI/badge.svg)](https://github.com/dxx/feignhttp/actions?query=workflow%3ACI)

FeignHTTP is a declarative HTTP client. Based on rust macros.

## Features

* Easy to use
* Asynchronous request
* Configurable timeout settings
* Supports plain text, form, multipart and JSON
* Selectable HTTP backends ([reqwest]https://github.com/seanmonstar/reqwest, [reqwest-middleware]https://github.com/TrueLayer/reqwest-middleware or [isahc]https://github.com/sagebind/isahc)

## Usage

FeignHTTP mark macros on asynchronous functions, you need a runtime for support async/await. You can use [tokio](https://github.com/tokio-rs/tokio).

tokio:

```toml
[dependencies]
tokio = { version = "1", features = ["full"] }
```

Add `feignhttp` in your `Cargo.toml` and use default feature:

```toml
feignhttp = { version = "0.6" }
```

Then add the following code:

```rust
use feignhttp::get;

#[get("https://api.github.com")]
async fn github() -> feignhttp::Result<String> {}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let r = github().await?;
    println!("result: {}", r);

    Ok(())
}
```

The `get` attribute macro specifies get request, `feignhttp::Result<String>` specifies the return result.
It will send get request to `https://api.github.com` and receive a plain text body.

Using non-default HTTP backend:

```toml
feignhttp = { version = "0.6", default-features = false, features = ["isahc-client"] }
```

The `default-features = false` option disable default reqwest.

For more examples, click [here](./examples).

## Documentation

Read the [documentation](https://docs.rs/feignhttp) for more details.

- [English]./docs/README.md
- [中文]./docs/README_zh.md

## License

FeignHTTP is provided under the MIT license. See [LICENSE](./LICENSE).