actix-multiresponse

Crates.ioactix-multiresponse
lib.rsactix-multiresponse
version0.4.2
sourcesrc
created_at2022-03-13 12:43:10.685563
updated_at2022-12-30 16:23:25.456052
descriptionactix-multiresponse intents to allow supporting multiple response/request data formats depending on the Content-Type and Accept headers
homepage
repositoryhttps://github.com/TobiasDeBruijn/actix-multiresponse
max_upload_size
id549199
size33,488
Tobias de Bruijn (TobiasDeBruijn)

documentation

https://docs.rs/actix-multiresponse/latest/actix_multiresponse/

README

actix-multiresponse

actix-multiresponse intents to allow supporting multiple response/request data formats depending on the Content-Type and Accept header.

Supported formats

  • Json
  • Protobuf
  • XML

All formats can be enabled using equally-named feature flags. At least one format should be enabled. By default json and protobuf are enabled.

Example

use prost_derive::Message;
use serde_derive::{Deserialize, Serialize};
use actix_multiresponse::Payload;

#[derive(Deserialize, Serialize, Message, Clone)]
struct TestPayload {
    #[prost(string, tag = "1")]
    foo: String,
    #[prost(int64, tag = "2")]
    bar: i64,
}

async fn responder(payload: Payload<TestPayload>) -> Payload<TestPayload> {
    payload
}

License

actix-multiresponse is dual licensed under the MIT or the Apache-2.0 license, at your discretion

Commit count: 10

cargo fmt