summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivien Kraus <vivien@planete-kraus.eu>2024-01-08 18:07:33 +0100
committerVivien Kraus <vivien@planete-kraus.eu>2024-01-08 18:07:33 +0100
commit3e19e1b9a020b085f45056395d586bfdb7d51ecf (patch)
tree261ee815b78eb49f8e9a496c16ec7d7b7248f9e7
parentb3429f3909e54762bd6929f6bc01d6612beb7962 (diff)
Make sure the gandi livedns API is accessed with POST or PUT0.0.6
-rw-r--r--guile/email-key-rotation/dns.scm2
-rw-r--r--guile/email-key-rotation/gandi.scm6
-rw-r--r--guile/email-key-rotation/tests/fake-gandi-livedns.scm10
3 files changed, 16 insertions, 2 deletions
diff --git a/guile/email-key-rotation/dns.scm b/guile/email-key-rotation/dns.scm
index 65dd75a..620a916 100644
--- a/guile/email-key-rotation/dns.scm
+++ b/guile/email-key-rotation/dns.scm
@@ -59,6 +59,7 @@
gandi-configuration
(gandi:domain gandi-configuration)
path-under-domain
+ #:method 'POST
#:headers headers
#:body body
#:http-request http-request)
@@ -69,6 +70,7 @@
gandi-configuration
(gandi:domain gandi-configuration)
path-under-domain
+ #:method 'PUT
#:headers headers
#:body body
#:http-request http-request)
diff --git a/guile/email-key-rotation/gandi.scm b/guile/email-key-rotation/gandi.scm
index 2f89785..ae9cc84 100644
--- a/guile/email-key-rotation/gandi.scm
+++ b/guile/email-key-rotation/gandi.scm
@@ -27,6 +27,7 @@
domain
path-under-domain
#:key
+ (method 'GET)
(headers '())
(body #f)
(http-request http-request))
@@ -66,7 +67,10 @@
`((Authorization
. ,(string-append "ApiKey " (api-key configuration)))
,@headers)))
- (http-request uri #:headers headers #:body body)))))
+ (http-request uri
+ #:method method
+ #:headers headers
+ #:body body)))))
(define (sxml->configuration sxml)
(with-exception-handler
diff --git a/guile/email-key-rotation/tests/fake-gandi-livedns.scm b/guile/email-key-rotation/tests/fake-gandi-livedns.scm
index 4e2df13..4a183ce 100644
--- a/guile/email-key-rotation/tests/fake-gandi-livedns.scm
+++ b/guile/email-key-rotation/tests/fake-gandi-livedns.scm
@@ -15,7 +15,15 @@
#:duplicates (merge-generics))
(define (fake-http-request expected-domain expected-api-key log-port)
- (lambda* (uri #:key headers body)
+ (lambda* (uri #:key method headers body)
+ (unless (or (equal? method 'POST)
+ (equal? method 'PUT))
+ (raise-exception
+ (make-exception
+ (make-error)
+ (make-exception-with-irritants (list method))
+ (make-exception-with-message
+ "Gandi method is neither POST nor PUT"))))
(unless (equal? (uri-scheme uri) 'https)
(raise-exception
(make-exception