http-client & filename in multipart/form-data added by siiky on Sat Feb 19 12:20:17 2022

(import http-client)
(with-input-from-request "http://localhost:4321"
                         `((file #:file ,(open-input-string "")
                                 #:filename "/filepath/to/be/sent/to/server"
                                 #:headers ((content-type application/x-directory))))
                         #f)

; The headers that I expected would be sent by http-client and the headers that
; are actually sent to the server.
;
; Expected:
;
; Content-Disposition: form-data; name="file"; filename="/filepath/to/be/sent/to/server"
; Content-Type: application/x-directory
;
; Actual:
;
; Content-Disposition: form-data; name="file"; filename="server"
; Content-Type: application/x-directory
;
;
; Patch (that doesn't work but I don't understand why...):
;
;720,724c720,725
;<                      (filename (or (kv-ref keys filename:)
;<                                    (and (port? file) (port-name file))
;<                                    (and (string? file) file)))
;<                      (filename (and filename
;<                                     (pathname-strip-directory filename)))
;---
;>                      (filename (kv-ref keys filename:))
;>                      (filename (or filename
;>                                    (and (port? file)
;>                                         (pathname-strip-directory (port-name file)))
;>                                    (and (string? file)
;>                                         (pathname-strip-directory file))))