[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Questions about the (web client) module.

From: Mark H Weaver
Subject: Re: Questions about the (web client) module.
Date: Fri, 21 Jul 2017 01:05:14 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Roel Janssen <address@hidden> writes:

> Here's the entire code I use:
> (define* (sparql-query-post query
>                        #:key
>                        (host "localhost")
>                        (port 8890)
>                        (graph "")
>                        (type "json"))
>   (let ((base-uri (string-append "http://"; host ":" (number->string port) ))
>         (boundary "guile-virtuoso-driver"))
>     (let ((body (string-append
>                  (format #f
>                   "--~a~%Content-Disposition: form-data; 
> name=~s~%~%text/csv~%"
>                   boundary "format")
>                   (format #f
>                   "--~a~%Content-Disposition: form-data; 
> name=~s~%~%~a~%--~a~%"
>                   boundary "query" query boundary))))
>       (http-post
>        (string-append base-uri "/sparql")
>        #:body body
>        #:headers `((content-length . ,(string-length body))

Another thing: you can omit the 'content-length' header here.  It will
be added automatically, and in fact the value you use here is incorrect
unless the body is ASCII-only, because it's supposed to be the length in
bytes, but here you are giving the length in characters.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]