aws/request: make-operation->request: Use requested HTTP method.
authorRicardo Wurmus <rekado@elephly.net>
Tue, 7 Jul 2020 19:31:49 +0000 (21:31 +0200)
committerRicardo Wurmus <rekado@elephly.net>
Tue, 7 Jul 2020 19:33:25 +0000 (21:33 +0200)
Don't just use POST; use whatever method the API operation requires.
Only add a request body for POST requests.

* aws/request.scm (make-operation->request): Use HTTP-REQUEST instead
of HTTP-POST.

aws/request.scm

index 764ed43390292f43bc1ccbbe3f7af647d0461330..d7e0822f0e97bdd0e270d8459b709dd11a9084b1 100644 (file)
@@ -33,8 +33,9 @@
 ;;; Commentary:
 
 ;;; See: http://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html
-;;; Make a POST request and pass request parameters in the body of the
-;;; request.  Auth information is provided in an Authorization header.
+;;; Make a request to the AWS API and pass request parameters in the
+;;; body of the request.  Auth information is provided in an
+;;; Authorization header.
 
 ;;; Code:
 
 
     (call-with-values
         (lambda ()
-          (http-post endpoint
-                     ;#:method (string->symbol method)
-                        #:body (string->utf8 request-parameters)
+          (http-request endpoint
+                        #:method (string->symbol method)
+                        #:body
+                        (match method
+                          ("POST"
+                           (string->utf8 request-parameters))
+                          (_ ""))
                         #:headers new-headers))
       (lambda (response body)
         (xml->sxml (match body