Matt Wette <matt.we...@gmail.com> writes:

> On 7/19/19 3:51 PM, zelphirkaltstahl wrote:
>> (module-define! (current-module)
>>                      ;; `route` should be `/container/json` for example.
>>                      route
>
> (quote route)

Yes, or equivalently:  'route

As an aside, is there a reason to not define it more simply as follows?

     Mark

--8<---------------cut here---------------start------------->8---
(define-syntax define-api-route
  (syntax-rules ()
    [(define-api-route route http-method my-content-type)
     ;; `route` should be `/container/json` for example.
     (define* (route docker-socket #:key (data #f))
       (call-with-values
           (lambda ()
             ;; Here the route needs to be given as a string to `http-get`.
             (http-get (variable-name->string route)
                       #:port docker-socket
                       #:version '(1 . 1)
                       #:keep-alive? #f
                       ;; Why is my quasiquote not working as expected?
                       #:headers `((host . ("localhost" . #f))
                                   (content-type . (,my-content-type (charset . 
"utf-8"))))
                       #:body (scm->json-string data)
                       #:decode-body? #t
                       #:streaming? #f))
         (lambda (response response-text)
           (let ([resp-text-as-string (bytevector->string response-text 
"utf-8")])
             (cons response resp-text-as-string)))))]))
--8<---------------cut here---------------end--------------->8---

Reply via email to