Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Middlewares not being applied #17

Open
EstebanBorai opened this issue Mar 11, 2023 · 0 comments
Open

Middlewares not being applied #17

EstebanBorai opened this issue Mar 11, 2023 · 0 comments

Comments

@EstebanBorai
Copy link

EstebanBorai commented Mar 11, 2023

Describe the bug
Currently middlewares applied using the middleware method from a Graphul instance,
are initialized but are not being applied as part of consuming HTTP Requests.

use std::time::Duration;

use graphul::{http::Methods, Graphul, middleware::limit::RateLimitLayer};

#[tokio::main]
async fn main() {
  tracing_subscriber::fmt::init();

  let mut app = Graphul::new();

  app.get("/noop", || async {
    "hello world!2"
  });

  app.middleware(RateLimitLayer::new(2, Duration::from_secs(100)));

  app.get("/", || async {
    "hello world!"
  });

  app.run("127.0.0.1:8000").await;
}

To Reproduce
Steps to reproduce the behavior:

  1. Create an instance of Graphul similar to how its done above
  2. Apply a middleware of your choice (This PR contains a dumb middleware for testing)
  3. Check for logs on terminal

Expected behavior

The middleware is applied

Screenshots

N/A

Desktop (please complete the following information):

  • OS: macOS, Linux
  • Browser N/A
  • Version 0.5.5 (Forked from main on commit: 58b1cb2)

Smartphone (please complete the following information):
N/A

Additional context
N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant