Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant