mirror of
https://github.com/benbusby/farside.git
synced 2025-04-20 10:58:42 +00:00
Ignore request types in router
Request types don't really matter in Farside, and should be ignored. This updates the router to handle all request types (GET, HEAD, POST, etc) the same as GET requests were handled previously.
This commit is contained in:
parent
f91e490696
commit
2a858b89d2
2 changed files with 4 additions and 4 deletions
|
@ -91,7 +91,7 @@ defmodule Farside do
|
||||||
# Either pick a random available instance,
|
# Either pick a random available instance,
|
||||||
# or fall back to the default one
|
# or fall back to the default one
|
||||||
instance =
|
instance =
|
||||||
if Enum.count(instances) > 0 do
|
if instances != nil && Enum.count(instances) > 0 do
|
||||||
if Enum.count(instances) == 1 do
|
if Enum.count(instances) == 1 do
|
||||||
# If there's only one instance, just return that one...
|
# If there's only one instance, just return that one...
|
||||||
List.first(instances)
|
List.first(instances)
|
||||||
|
|
|
@ -18,7 +18,7 @@ defmodule Farside.Router do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
get "/" do
|
match "/" do
|
||||||
resp =
|
resp =
|
||||||
EEx.eval_file(
|
EEx.eval_file(
|
||||||
@index,
|
@index,
|
||||||
|
@ -29,7 +29,7 @@ defmodule Farside.Router do
|
||||||
send_resp(conn, 200, resp)
|
send_resp(conn, 200, resp)
|
||||||
end
|
end
|
||||||
|
|
||||||
get "/_/:service/*glob" do
|
match "/_/:service/*glob" do
|
||||||
r_path = String.slice(conn.request_path, 2..-1)
|
r_path = String.slice(conn.request_path, 2..-1)
|
||||||
|
|
||||||
resp =
|
resp =
|
||||||
|
@ -41,7 +41,7 @@ defmodule Farside.Router do
|
||||||
send_resp(conn, 200, resp)
|
send_resp(conn, 200, resp)
|
||||||
end
|
end
|
||||||
|
|
||||||
get "/:service/*glob" do
|
match "/:service/*glob" do
|
||||||
service_name = cond do
|
service_name = cond do
|
||||||
service =~ "http" ->
|
service =~ "http" ->
|
||||||
List.first(glob)
|
List.first(glob)
|
||||||
|
|
Loading…
Add table
Reference in a new issue