Merge pull request #207 from jolt-lang/fix/io-copy-htable-input-stream

io/copy: drain a byte-input-stream shim source
This commit is contained in:
Dmitri Sotnikov 2026-06-25 13:04:21 +00:00 committed by GitHub
commit 93b4d101a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -275,6 +275,10 @@
(cond ((in-stream? input) (let ((bv (get-bytevector-all (in-stream-port input)))) (if (eof-object? bv) (make-bytevector 0) bv)))
((bytevector? input) input)
((and (jolt-array? input) (eq? (jolt-array-kind input) 'byte)) (na-bytearray->bv input))
;; a byte-input-stream shim (host tagged-table, :jolt/input-stream — e.g.
;; http-client's ByteArrayInputStream): drain it byte-exact, like slurp.
((and (htable? input) (jolt-truthy? (jolt-ref-get input (keyword "jolt" "input-stream"))))
(drain-byte-stream input))
(else #f)))
(define (input-text input)
(cond ((string? input) input)