diff options
| author | Jakob L. Kreuze | 2023-03-11 16:51:46 -0500 |
|---|---|---|
| committer | Jakob L. Kreuze | 2023-03-11 16:51:55 -0500 |
| commit | 4d07077daedc30271be69c86c855795affdea860 (patch) | |
| tree | 7ac343c51a930b86b23507ca38ddd2ef620dde26 /haunt/jakob/dynamic/capabilities | |
| parent | 45f5c3c0f8e745bc2392a8c5821f09913604da04 (diff) | |
Address parsing issues in `put-reaction' endpoint
Diffstat (limited to 'haunt/jakob/dynamic/capabilities')
| -rw-r--r-- | haunt/jakob/dynamic/capabilities/comments.scm | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/haunt/jakob/dynamic/capabilities/comments.scm b/haunt/jakob/dynamic/capabilities/comments.scm index 98560b0..1da8abb 100644 --- a/haunt/jakob/dynamic/capabilities/comments.scm +++ b/haunt/jakob/dynamic/capabilities/comments.scm @@ -188,15 +188,12 @@ This is a wrapper around `get-comments-by-slug'." (define (valid-reaction? form-data) (and (assoc "id" form-data) (assoc "reaction" form-data))) - (let* ((query-string (uri-query (request-uri request))) - (form-data (if query-string - (decode-form query-string) - '()))) + (let ((form-data (decode-form body))) (unless (assoc "id" form-data) (panic "missing param `id'")) (unless (assoc "reaction" form-data) (panic "missing param `reaction'")) - (let ((id (assoc-value form-data "id")) - (reaction (assoc-value form-data "reaction")) - (reactions (comment-reactions id))) + (let* ((id (assoc-value form-data "id")) + (reaction (assoc-value form-data "reaction")) + (reactions (comment-reactions id))) (unless reactions (panic "no such comment")) (set-reactions id (add-reaction reactions reaction)) (values '((content-type . (application/json))) |