Just
Just copied to clipboard
Allow non-filename HTTPFile.text
Hello 😄 I'm using Just HTTP client in my product, but I found some problem.
I tried to scrape Slack web site with Just. In particular, I attempted to send the following request to Slack, and it failed.
var files: [String: HTTPFile] = [:]
files["name"] = .text("name", "name"", nil)
files["crumb"] = .text("crumb", "xxxxxx", nil)
files["mode"] = .text("mode", "data", nil)
files["add"] = .text("add", "1", nil)
files["img"] = .data("emoji.png", data, "image/png")
Just.post("https://my-team.slack.com/customize/emoji", files: files)
I was in great trouble, trial and error, and I found out that the cause is as follows.
let dispose = "Content-Disposition: form-data; name=\"\(k)\"; filename=\"\(filename)\"\r\n"
Content-Disposition
header contained filename
filed was not accepted at Slack.
So that, I've patched like this PR, and it works.
Thank you.