Add get,post,put,head,delete,patch to easily perform requests
This commit is contained in:
parent
85b52dab77
commit
ee61ecfdf1
1 changed files with 7 additions and 0 deletions
|
@ -4,6 +4,7 @@ require "kemal"
|
|||
TIME_TO_SLEEP = 0.00001
|
||||
APP_PORT = 1989
|
||||
APP_ENV = "test"
|
||||
APP_URL = "http://localhost:#{APP_PORT}"
|
||||
|
||||
Kemal.config.env = APP_ENV
|
||||
Kemal.config.port = APP_PORT
|
||||
|
@ -21,3 +22,9 @@ Spec.after_each do
|
|||
Kemal.config.server.close
|
||||
end
|
||||
end
|
||||
|
||||
{% for method in %w(get post put head delete patch) %}
|
||||
def {{method.id}}(path, headers : HTTP::Headers? = nil, body : String? = nil)
|
||||
HTTP::Client.{{method.id}}(APP_URL + path, headers, body)
|
||||
end
|
||||
{% end %}
|
||||
|
|
Loading…
Reference in a new issue