actix-web Questions

3

Solved

I am building a REST API with actix-web. How do I configure CORS to accept requests from any origin? Cors::new() // <- Construct CORS middleware builder .allowed_origin("localhost:8081") .all...
Welt asked 16/12, 2019 at 7:9

3

Solved

I'm using actix-web to create a httpserver with state/data embedded in it. But vscode show me that the create_app function has wrong arguments in its return value type definition App<AppState&gt...
Bondsman asked 12/8, 2019 at 7:33

2

I am getting this error running an actix-web based server ERROR actix_http::h1::dispatcher] stream error: Request parse error: Invalid Header provided The handler code is this: #[derive(Serialize,...
Brink asked 3/4, 2022 at 9:6

3

I am using actix-web to write a small service. I'm adding integration tests to assess the functionality and have noticed that on every test I have to repeat the same definitions that in my main App...
Dispute asked 28/5, 2022 at 11:20

4

Solved

In the Actix Web Framework, how does one use the route attributes macros (#[http_method("route")]) to bind multiple http methods to one function? For example, I have this trivial endpoint: /// Re...
Warram asked 19/2, 2020 at 21:12

3

Solved

I want to run a web server with Rust and Actix-Web. After following these steps of their documentation everything works as expected: the server runs on port 8080. The problem I have is that VSCode ...
Dyslexia asked 23/6, 2022 at 14:55

10

Solved

I have hello world web project in Rust + Actix-web. I have several problems. First is every change in code causes recompiling whole project including downloading and compiling every crate. I'd like...
Wanitawanneeickel asked 20/10, 2019 at 13:42

3

Solved

I've moved from using actix-web 3.x.x to 4.x.x. and the code that's been running perfectly fine before is now throwing this error: the trait bound `fn(actix_web::web::Query<TweetParams>, acti...
Expressive asked 2/6, 2021 at 19:39

1

Solved

I'm new to actix, and I'm trying to understand how I can run a server on one thread and send requests from another. This is the code I have so far use actix_web::{web, App, HttpResponse, HttpServer...
Torres asked 8/2, 2023 at 13:26

1

Solved

I have a simple application with an HTTP endpoint and a connection to a MongoDB database. use actix_web::{ middleware, post, web::{self}, App, HttpServer, Responder, }; use mongodb::{options::Cl...
Fraenum asked 5/8, 2022 at 21:24

2

Solved

If I was to use this code on Actix Web 3 it would work, but I need to use the latest stable release... so 4^. Here is the snippet in question (actually this is the entirety of my code): use actix_w...
Decapod asked 24/6, 2022 at 19:47

2

Solved

Is there a recommended way of modifying the request received on actix-web? I am looking for way to add data to the request object and have it available for processing by downstream middleware...
Turbot asked 12/8, 2021 at 13:52

1

Solved

Here is My Dockerfile: FROM ubuntu:20.04 RUN apt-get update && apt-get upgrade -y RUN apt-get install libssl-dev RUN apt-get install -y -q build-essential curl RUN curl https://sh.rustup.r...
Mouthpiece asked 15/4, 2022 at 16:22

5

Solved

I'm using the Actix framework to create a simple server and I've implemented a file upload using a simple HTML frontend. use actix_web::web::Data; use actix_web::{middleware, web, App, HttpRespons...
Jacobian asked 13/5, 2019 at 17:33

4

I'm building a web API service with Rust and actix_web. I want to test a route and check if the received response body is what I expect. But I'm struggling with converting the received body Respons...
Pisgah asked 15/9, 2020 at 22:30

1

I'm trying to figure out how Extensions are created in the actix-web Rust library. I think I'm missing the concept of request extensions. What do request extensions do? How are they different from ...
Flair asked 31/8, 2021 at 4:11

1

Solved

Is there a way to log all requests being received by actix-web irrespective of whether the endpoint exists or not? It seems I need to use middleware for this, is this the recommended approach?
Krefeld asked 10/8, 2021 at 15:19

1

Solved

I'm building a web server with Actix-web and one of the methods uses reqwest to make HTTP requests to an external API: #[get("/foo")] async fn foo() -> impl Responder { let resp = req...
Mathewson asked 5/8, 2021 at 14:10

1

Solved

I'm trying to write an authentication middleware for my Actix application. When validating the request in the middleware, I make a call to a database to retrieve the necessary user data to validate...
Apulia asked 31/8, 2020 at 15:12

5

Solved

I need to verify if the user has permission for some routes. I have made 3 "scopes" (guest, auth-user, admin) and now I don't know how to check if the user has access to these routes. I'm...
Deferred asked 8/6, 2020 at 18:53

1

Solved

Is it possible to obtain the IP address from a HttpRequest argument? This is my code: #[get("/collect")] pub async fn collect(req: HttpRequest) -> impl Responder { println!("coll...
Procto asked 7/4, 2021 at 15:59

2

Solved

I'm currently implementing a server using Rust and Actix-Web. My task now is to send a request (ping-request) from this server to another server every 10 seconds. The ping-request itself is impleme...
Farlay asked 23/9, 2020 at 11:9

2

Solved

I attempted to update to actix_rt 2.0.2 and have since been getting the following error: thread 'main' panicked at 'System is not running' Here is my minimal example: # Cargo.toml [dependencies] a...
Virgievirgil asked 21/2, 2021 at 7:59

1

Currently I have a main written like the async example for the Reqwest library. #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { We can use the exact examp...
Ailin asked 1/3, 2021 at 3:15

1

Solved

When I try to use actix-web 3 and rusoto 0.46 together I get the following runtime error: thread 'actix-rt:worker:0' panicked at 'there is no reactor running, must be called from the context of a T...
Fenrir asked 9/2, 2021 at 13:22

© 2022 - 2024 — McMap. All rights reserved.