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

Plugin API, HTTP path is always / #699

Closed
i-am-kenny opened this issue Mar 18, 2022 · 0 comments · Fixed by #705
Closed

Plugin API, HTTP path is always / #699

i-am-kenny opened this issue Mar 18, 2022 · 0 comments · Fixed by #705
Assignees
Labels

Comments

@i-am-kenny
Copy link

Describe the bug
When inspecting the HTTP request from within a plugin, the URL path is always /

To Reproduce
Steps to reproduce the behavior:

  1. Use v0.1.0-alpha.9
  2. Create a simple plugin
  3. Add a hook for the router_service that prints out the URL path
fn router_service(
    &mut self,
    service: BoxService<RouterRequest, RouterResponse, BoxError>,
) -> BoxService<RouterRequest, RouterResponse, BoxError> {
    ServiceBuilder::new()
        .map_request(|req: RouterRequest| {
        	println!("{}", req.context.request.url().path());

        	req
        })
        .service(service)
        .boxed()
}
  1. Make GraphQL requests to the server with varying paths URL /, /graphql/foo, graphql/bar
  2. Note that it is always / regardless of the request path

Expected behavior
I would expect requests that go to host.com/graphql/foo would have a path value of /graphql/foo in the url struct.

Additional context
We include the operation name in our URL path, so being able to validate that the operation name in the path matches the operation name in the body would be helpful.

@BrynCooke BrynCooke added bug and removed triage labels Mar 20, 2022
@bnjjj bnjjj self-assigned this Mar 21, 2022
bnjjj added a commit that referenced this issue Mar 21, 2022
…request #699

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
bnjjj added a commit that referenced this issue Mar 21, 2022
…request #699

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
@abernix abernix added this to the v0.1.0-alpha.10 milestone Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants