Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow non-filename HTTPFile.text #90

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pine
Copy link

@pine pine commented Sep 18, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant