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...
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>...
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,...
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...
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...
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...
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...
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...
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...
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...
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...
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 ...
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?
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...
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...
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...
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...
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...
1 Next >
© 2022 - 2024 — McMap. All rights reserved.