unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: Roel Janssen <roel@gnu.org>
Cc: "Ludovic Courtès" <ludo@gnu.org>, guile-user@gnu.org
Subject: Re: Questions about the (web client) module.
Date: Fri, 21 Jul 2017 01:05:14 -0400	[thread overview]
Message-ID: <87bmoecrcl.fsf@netris.org> (raw)
In-Reply-To: <87h8y691nm.fsf@gnu.org> (Roel Janssen's message of "Fri, 21 Jul 2017 00:36:13 +0200")

Roel Janssen <roel@gnu.org> 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.

      Mark



      parent reply	other threads:[~2017-07-21  5:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-20 10:53 Questions about the (web client) module Roel Janssen
2017-07-20 15:41 ` Ludovic Courtès
2017-07-20 22:36   ` Roel Janssen
2017-07-21  4:49     ` Mark H Weaver
2017-07-21  5:05     ` Mark H Weaver [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bmoecrcl.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=guile-user@gnu.org \
    --cc=ludo@gnu.org \
    --cc=roel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).