/http-read

simple http client on chicken scheme

Primary LanguageScheme

http-read

simple http client. If you want a more rich client, user http-client.

usage

(http-read url #!key (header '()) (method 'get) (query '()) proxy) -> <response>

Header is an alist. Allowed methods are ‘get, ‘head, ‘post, ‘put, ‘delete.

(response-status <response>)

Response status is a pair of status-code and response-phrase. (e.g. ‘(200 . “OK”))

(response-header <response>)

Response header is an alist of which key is downcased symbol. (e.g. content-length)

(response-body <respone>)

example

(define result
  (http-read "https://www.google.co.jp/search"
             #:query '((q . "日本語")
                       (ie . "UTF-8")
                       (oe . "UTF-8")
                       (num . 20))
             #:header '((User-Agent . "hoge"))))

(with-output-to-file "test.html"
  (lambda ()
    (display (response-body result))))