Skip to content

Commit

Permalink
Use http scheme for url (#42)
Browse files Browse the repository at this point in the history
* Use `http` scheme for url

* Fixup

* Fixup
  • Loading branch information
Sija authored Dec 24, 2023
1 parent 48902c6 commit d038d56
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 @@ -26,6 +26,13 @@ abstract class ExceptionPage
"all"
end
end

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

include Helpers
Expand Down Expand Up @@ -67,7 +74,7 @@ abstract class ExceptionPage
@headers = context.response.headers.to_h
@method = context.request.method
@path = context.request.path
@url = "#{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 d038d56

Please sign in to comment.