Created
January 30, 2018 13:34
-
-
Save cored/ea453cb72c8cf35f337051e45efeaf46 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Servy.Conv do | |
alias Servy.Conv | |
defstruct method: "", path: "", resp_body: "", status: nil | |
def full_status(%Conv{} = conv) do | |
"#{conv.status} #{status_reason(conv.status)}" | |
end | |
defp status_reason(code) do | |
%{ | |
200 => "OK", | |
201 => "Created", | |
401 => "Unauthorized", | |
403 => "Forbidden", | |
404 => "Not Found", | |
500 => "Internal Server Error", | |
}[code] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment