diff options
author | Paul Duncan <pabs@pablotron.org> | 2016-03-15 00:11:28 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2016-03-15 00:11:28 -0400 |
commit | 9ebc1a57335e3b183be9a0494cdc377a19219222 (patch) | |
tree | 1a38b83945320c5c19a26c7b652315e8a1897dea /src/guff/handlers/api.cr | |
parent | cf34c28f84b9c47bdd03cf8011a5c40495c2b289 (diff) | |
download | old-guff-9ebc1a57335e3b183be9a0494cdc377a19219222.tar.bz2 old-guff-9ebc1a57335e3b183be9a0494cdc377a19219222.zip |
initial session support
Diffstat (limited to 'src/guff/handlers/api.cr')
-rw-r--r-- | src/guff/handlers/api.cr | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/guff/handlers/api.cr b/src/guff/handlers/api.cr index 4401f75..6f5c528 100644 --- a/src/guff/handlers/api.cr +++ b/src/guff/handlers/api.cr @@ -10,8 +10,17 @@ private macro define_method_calls(hash) case method {% for method in methods %} when "{{ method }}" + params = case context.request.method + when "GET" + context.request.query_params + when "POST" + HTTP::Params.parse((context.request.body || "") as String) + else + raise "unsupported method" + end + do_{{ namespace.id }}_{{ method }}(context, get_method_args( - context.request.query_params, + params, "{{ namespace.id }}", "{{ method.id }}" )).to_json |