Make more web server encoding tweaks
This commit is contained in:
parent
b0bb65dbed
commit
cb2085b684
2 changed files with 33 additions and 12 deletions
|
@ -81,6 +81,34 @@
|
|||
"☺"
|
||||
body)))))
|
||||
|
||||
(run-fibers-for-tests
|
||||
(lambda ()
|
||||
(let* ((web-server
|
||||
(run-knots-web-server
|
||||
(lambda (request)
|
||||
(values '((content-type . (text/plain
|
||||
(charset . "utf-8")))
|
||||
(content-length . 3))
|
||||
(lambda (port)
|
||||
(display "☺" port))))
|
||||
#:port 0)) ;; Bind to any port
|
||||
(port
|
||||
(web-server-port web-server))
|
||||
(uri
|
||||
(build-uri 'http #:host "127.0.0.1" #:port port)))
|
||||
|
||||
(let ((response
|
||||
body
|
||||
(http-get
|
||||
uri
|
||||
;; TODO Remove once using Guile 3.0.10
|
||||
#:streaming? #t
|
||||
#:port (non-blocking-open-socket-for-uri uri))))
|
||||
(assert-equal
|
||||
"☺"
|
||||
(utf8->string
|
||||
(get-bytevector-n body 3)))))))
|
||||
|
||||
;; Test hanlding of exceptions when writing the response to a client
|
||||
(run-fibers-for-tests
|
||||
(lambda ()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue