Skip to content

Commit

Permalink
Fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Sija authored Dec 23, 2023
1 parent 0081855 commit 09fbc6c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/exception_page.cr
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ abstract class ExceptionPage
end
end

def host_from_context(context)
if host = context.request.headers["Host"]?
host = "http://#{host}"
end
host
end

include Helpers

@params : Hash(String, String)
Expand Down Expand Up @@ -66,7 +73,7 @@ abstract class ExceptionPage
@headers = context.response.headers.to_h
@method = context.request.method
@path = context.request.path
@url = "http://#{context.request.headers["Host"]?}#{context.request.path}"
@url = "#{host_from_context(context)}#{context.request.path}"
@query = context.request.query_params.to_s
@session = context.response.cookies.to_h
end
Expand Down

0 comments on commit 09fbc6c

Please sign in to comment.