PSPDFKit-labs / bypass

Bypass provides a quick way to create a custom plug that can be put in place instead of an actual HTTP server to return prebaked responses to client requests.
https://hex.pm/packages/bypass
MIT License
951 stars 108 forks source link

Route error on valid routes #76

Open Schultzer opened 5 years ago

Schultzer commented 5 years ago

Hi,

I get an Route error on routes with decimal values like /myroute/v1/0,10.0

Request: GET /myroute/v1/0,10.0
** (exit) an exception was raised:
    ** (RuntimeError) Route error
        (bypass) lib/bypass/plug.ex:24: Bypass.Plug.call/2
        (plug_cowboy) lib/plug/cowboy/handler.ex:12: Plug.Cowboy.Handler.init/2
        (cowboy) myroute/deps/cowboy/src/cowboy_handler.erl:41: :cowboy_handler.execute/2
        (cowboy) myroute/deps/cowboy/src/cowboy_stream_h.erl:296: :cowboy_stream_h.execute/3
        (cowboy) myroute/deps/cowboy/src/cowboy_stream_h.erl:274: :cowboy_stream_h.request_process/3
        (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

OWM use these routes example here https://samples.openweathermap.org/pollution/v1/co/0.0,10.0/current.json?appid=b1b15e88fa797225412429c1c50c122a1

I'm not sure if this is a Plug specific issue.

mvalitov commented 5 years ago

I get the same error when there are parameters in the route via "?"

mvalitov commented 5 years ago

look at here https://github.com/PSPDFKit-labs/bypass/issues/55

anthonator commented 4 years ago

Bypass also doesn't accept paths with double /. For instance //fake throws the Route error exception. I've never encountered an HTTP client or server that would reject this.

thiamsantos commented 3 years ago

@Schultzer @anthonator Really strange this behaviour. I just tested GET /myroute/v1/0,10.0 and GET //fake and it worked normally. There was any special scenario that triggered this error?

Schultzer commented 3 years ago

@thiamsantos I don't know and I don't use bypass anymore, but maybe you could just add some test cases; to make sure, this is working, with previous and current OTP/Elixir releases;

Nezteb commented 1 month ago

I've also run into this. Specifically any URL paths with query params will cause the "route error".