Hi guys, I'm trying to serve a file using a restful API via dispatcher. The file is being served but I'm also getting some funky contract errors that I don't really understand.
The function is (define (generate-zip-response zip-path) (let* ([size-bs (string->bytes/utf-8 (number->string (file-size zip-path)))] [zip-binary (file->bytes zip-path)] [patch-name-bs (string->bytes/utf-8 patch-name)]) (response/output #:mime-type #"application/octet-stream" #:headers (list (make-header #"Content-Disposition" (bytes-append #"attachment; filename=\"" patch-name-bs #".zip\"")) (make-header #"Content-Transfer-Encoding" #"binary") (make-header #"Content-Length" size-bs)) (lambda (output) (write-bytes zip-binary output))))) and the contract error which is printed whenever a file is served is: response/output: contract violation expected: void? given: 2113471 in: the range of the 1st argument of (->* ((-> output-port? void?)) (#:code number? #:headers (listof header?) #:message bytes? #:mime-type (or/c bytes? #f) #:seconds number?) response?) contract from: <pkgs>/web-server-lib/web-server/http/response-structs.rkt blaming: C:\builder\server-dispatch.rkt (assuming the contract is correct) at: <pkgs>/web-server-lib/web-server/http/response-structs.rkt:41.2 where 2113471 is the size of the file I am serving. Any pointers would be helpful, Cheers, Craig -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.