FMT: mix fmt
This commit is contained in:
parent
dcc753a106
commit
70822b178e
|
@ -24,28 +24,20 @@ defmodule RlRepo.ClientHandler do
|
|||
def create_response(request) do
|
||||
# TODO: Split off the info I need from the request body and I guess pass it around also
|
||||
Logger.info("REQUEST BODY #{request}")
|
||||
|
||||
Logger.info("Building response body.")
|
||||
|
||||
|
||||
# TODO: Handle routing here.
|
||||
a = String.split(request, "\n\r")
|
||||
# Logger.info a
|
||||
[get_line | rest] = a
|
||||
[get_line | rest] = String.split(request, "\n\r")
|
||||
|
||||
b = String.split(get_line, " ")
|
||||
[request_type | rest] = b
|
||||
[path | rest] = rest
|
||||
Logger.info("#{request_type} #{path}")
|
||||
|
||||
# Parse path
|
||||
# Parse path ignoring leading and trailing slash
|
||||
split_path = String.split(path, "/", trim: true)
|
||||
# Ignore the first slash.
|
||||
# [_ | rest ] = split_path
|
||||
|
||||
split_path_length = length(split_path)
|
||||
|
||||
ret =
|
||||
case split_path_length do
|
||||
1 ->
|
||||
RlRepo.Router.parse_1_segment_path(rest)
|
||||
|
@ -63,8 +55,6 @@ defmodule RlRepo.ClientHandler do
|
|||
_ ->
|
||||
RlRepo.Router.status_404()
|
||||
end
|
||||
|
||||
ret
|
||||
end
|
||||
|
||||
def create_return_code_string(return_code) do
|
||||
|
|
|
@ -10,12 +10,8 @@ defmodule RlRepo.Template do
|
|||
|
||||
def inner_template(body, replacements) do
|
||||
# TODO: Check if there is any actual placeholders
|
||||
v = String.contains?(body, "~(")
|
||||
# Logger.info(v)
|
||||
|
||||
# v = String.contains?(body, "~(")
|
||||
len = body |> String.split("~(") |> length()
|
||||
# Logger.info(body)
|
||||
|
||||
template_step(replacements, body, len)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,12 +10,10 @@ defmodule RlRepoTest do
|
|||
assert RlRepo.Template.inner_template(body, placeholders) == "DONE"
|
||||
end
|
||||
|
||||
|
||||
test "multi template replace" do
|
||||
body = "~(replace)abc~(replace)"
|
||||
placeholders = %{"replace" => "DONE"}
|
||||
|
||||
assert RlRepo.Template.inner_template(body, placeholders) == "DONEabcDONE"
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue