setting up more for idk, rust servers i guess
This commit is contained in:
parent
09f3ea62f2
commit
d8740cdb73
25
Cargo.lock
generated
25
Cargo.lock
generated
|
@ -914,6 +914,24 @@ dependencies = [
|
|||
"windows-sys 0.45.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "multer"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "01acbdc23469fd8fe07ab135923371d5f5a422fbf9c522158677c8eb15bc51c2"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"encoding_rs",
|
||||
"futures-util",
|
||||
"http",
|
||||
"httparse",
|
||||
"log",
|
||||
"memchr",
|
||||
"mime",
|
||||
"spin",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "native-tls"
|
||||
version = "0.2.11"
|
||||
|
@ -1319,6 +1337,12 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spin"
|
||||
version = "0.9.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.109"
|
||||
|
@ -1371,6 +1395,7 @@ dependencies = [
|
|||
"actix-rt",
|
||||
"actix-web",
|
||||
"env_logger",
|
||||
"multer",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
|
|
@ -6,6 +6,7 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
multer = "2.1.0"
|
||||
actix = "0.13.0"
|
||||
actix-rt = "2.8.0"
|
||||
actix-web = "4.3.1"
|
||||
|
|
|
@ -67,9 +67,9 @@
|
|||
/* console.log(JSON.stringify(data)); */
|
||||
fetch("http://localhost:4242/health-form", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
/* headers: {
|
||||
* "Content-Type": "multipart/form-data",
|
||||
* }, */
|
||||
body: data
|
||||
}).then((res) => {
|
||||
console.log(res);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use std::{env, io};
|
||||
use actix_web::{middleware, web, App, HttpServer, get, post, Responder, http::header::ContentType, HttpResponse, HttpRequest, http::{StatusCode, Method}};
|
||||
use actix_web::{middleware, web, App, HttpServer, get, post, Responder, http::header::ContentType, HttpResponse, HttpRequest, http::{StatusCode, Method}, HttpMessage};
|
||||
use multer::Multipart;
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> io::Result<()> {
|
||||
|
@ -21,5 +22,9 @@ async fn main() -> io::Result<()> {
|
|||
#[post("/health-form")]
|
||||
async fn form(req: HttpRequest) -> HttpResponse {
|
||||
println!("{req:?}");
|
||||
println!("{:?}", req.content_type());
|
||||
println!("{:?}", req);
|
||||
println!("{:?}", req.headers().get("content-type"));
|
||||
// let multipart = Multipart::new(stream, boundary);
|
||||
HttpResponse::Ok().respond_to(&req)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue