From your netcat output I inferred that you wanted two content-type headers, but I don't think you do, I guess you just want to control the content-type.
When creating a ZnPart based on a file, the content-type is inferred automatically from the filename's extension. The simplest solution is to use an unknown file type, like .bin or .dat which will result in a content-type of application/octet-stream (the default). ZnMimePart fieldName: 'file' fileNamed: '/tmp/foo.bin'. You could try setting the content-type after creation. | part | part := ZnMimePart fieldName: 'file' fileNamed: '/tmp/foo.txt'. part headers contentType: ZnMimeType default. part. The methods #setContentType: could be added to ZnMimePart, I guess.
On 10 Feb 2016, at 13:42, chicoary <chicoary@gmail.com> wrote:
Thanks Sven for your reply.
The curl I want reproduce with Zinc is:
curl 'http://localhost:5001/api/v0/add?stream-channels=true' \ -H 'content-type: multipart/form-data; boundary=a831rwxi1a3gzaorw1w2z49dlsor' \ -H 'Connection: keep-alive' \ --data-binary $'--a831rwxi1a3gzaorw1w2z49dlsor\r\nContent-Type: application/octet-stream\r\nContent-Disposition: file; name="file"; filename="file.txt"\r\n\r\nfile.txt contents--a831rwxi1a3gzaorw1w2z49dlsor--' --compressed
It is like an example in https://github.com/ipfs/js-ipfs-api#tooling.
I want to implement the ipfs add command in my project http://smalltalkhub.com/#!/~chicoary/SmallIPFS/.
----- http://chicoary@gmail.com -- View this message in context: http://forum.world.st/How-to-generate-Content-Type-application-octet-stream-... Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.