Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/bypass/instance.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Bypass.Instance do
use GenServer, restart: :transient

import Bypass.Utils
import Plug.Router.Utils, only: [build_path_match: 1]
import Plug.Router.Utils, only: [build_path_match: 1, split: 1]

def start_link(opts \\ []) do
GenServer.start_link(__MODULE__, [opts])
Expand Down Expand Up @@ -297,7 +297,7 @@ defmodule Bypass.Instance do
end

defp route_info(method, path, %{expectations: expectations} = _state) do
segments = build_path_match(path) |> elem(1)
segments = path |> split

route =
expectations
Expand Down
11 changes: 11 additions & 0 deletions test/bypass_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -643,4 +643,15 @@ defmodule BypassTest do
Bypass.open(:error)
end
end

test "path can contain colon" do
bypass = Bypass.open()

Bypass.expect(bypass, "POST", "/resources/:resource", fn conn ->
assert conn.params == %{ "resource" => ":resource" }
Plug.Conn.send_resp(conn, 200, "")
end)

assert {:ok, 200, ""} = request(bypass.port, "/resources/:resource")
end
end