feat: echo post api endpoint
This endpoint responds with the body that was sent with the post requestmain
parent
2a71ade56f
commit
76ec0ce0f4
@ -0,0 +1,13 @@
|
||||
use rapid_web::actix::web::Bytes;
|
||||
use rapid_web::actix::HttpResponse;
|
||||
use rapid_web::rapid_web_codegen::rapid_handler;
|
||||
|
||||
pub const ROUTE_KEY: &str = "echo";
|
||||
pub type RapidOutput = String;
|
||||
|
||||
#[rapid_handler]
|
||||
pub async fn post(bytes: Bytes) -> HttpResponse {
|
||||
let body = String::from_utf8(bytes.to_vec()).unwrap();
|
||||
println!("Body: {}", &body);
|
||||
HttpResponse::Ok().body(body)
|
||||
}
|
Loading…
Reference in New Issue