AtlatestRepositorysigil-http
sigil-http / tree / test / integrationintegration-server.sgl
1
;;; Test server for integration tests2
;;; Listens on port specified as first argument (default 8099)4
(import (sigil http server)5
(sigil http request)6
(sigil http response))8
(define (handler request)9
(let ((path (http-request-path request))10
(body (http-request-body request)))11
(cond12
((string=? path "/echo-body")13
(http-response/text HTTP-OK (or body "(no body)")))14
((string=? path "/hello")15
(http-response/text HTTP-OK "Hello, World!"))16
(else17
(http-response/not-found)))))19
;; Use port 8099 for testing20
(http-serve handler port: 8099)