HTTPieを使用して multipart/form-data リクエストを POST します (オプションを渡し-fます)。ファイル フィールドが含まれます (@オプションを使用)。マルチパート リクエストの対応する部分には pseudo-headerContent-Dispositionがありますが、 pseudo-header はありませんContent-Type。
Content-Type特定のファイルにそのようなものを追加するにはどうすればよいですか?
完全を期すために、ここに私が今送信するものがあります( で示されているように-p B):
--xyz
Content-Disposition: form-data; name="file"; filename="file.txt"
Hello, world!
This is the content of the file.
--xyz
しかし、ここに私が送信する必要があるものがあります:
--xyz
Content-Disposition: form-data; name="file"; filename="file.txt"
Content-Type: text/plain
Hello, world!
This is the content of the file.
--xyz
または、別の言い方をすれば、CURL の同等のオプションのように: -F "file=file.txt;type=text/plain".