Skip to content

Commit

Permalink
path_starts_with... method naming (#310)
Browse files Browse the repository at this point in the history
Fix name of path_starts_with_... utility method
  • Loading branch information
t-richards authored and sdogruyol committed Feb 15, 2017
1 parent 9607083 commit 54e501e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/kemal/dsl.cr
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ FILTER_METHODS = %w(get post put patch delete options all)

{% for method in HTTP_METHODS %}
def {{method.id}}(path, &block : HTTP::Server::Context -> _)
raise Kemal::Exceptions::InvalidPathStartException.new({{method}}, path) unless Kemal::Utils.path_starts_with_backslash?(path)
raise Kemal::Exceptions::InvalidPathStartException.new({{method}}, path) unless Kemal::Utils.path_starts_with_slash?(path)
Kemal::RouteHandler::INSTANCE.add_route({{method}}.upcase, path, &block)
end
{% end %}

def ws(path, &block : HTTP::WebSocket, HTTP::Server::Context -> Void)
raise Kemal::Exceptions::InvalidPathStartException.new("ws", path) unless Kemal::Utils.path_starts_with_backslash?(path)
raise Kemal::Exceptions::InvalidPathStartException.new("ws", path) unless Kemal::Utils.path_starts_with_slash?(path)
Kemal::WebSocketHandler.new path, &block
end

Expand Down
2 changes: 1 addition & 1 deletion src/kemal/helpers/utils.cr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Kemal
module Utils
def self.path_starts_with_backslash?(path)
def self.path_starts_with_slash?(path)
path.starts_with?("/")
end

Expand Down

0 comments on commit 54e501e

Please sign in to comment.