node-twitter icon indicating copy to clipboard operation
node-twitter copied to clipboard

Set the “Content-Transfer-Encoding: base64” header on base64 encoded images

Open seanpoulter opened this issue 6 years ago • 2 comments

As a developer, I'd like to POST base64 encoded images but we* get an error. By "we" I mean, this dev: https://stackoverflow.com/questions/50261958

From the Twitter docs on Media Best Practices it says:

When posting base64 encoded images, be sure to set the “Content-Transfer-Encoding: base64” on the image part of the message.

That's currently not possible based on how the params are passed from post to __request and into _this.request. Would you welcome a PR to allow params.headers in the options? If yes, would you like them to be removed from the query string before all the params used as the query string here: options.qs = params.

seanpoulter avatar May 10 '18 03:05 seanpoulter

Did U ever solve this?

I am trying to pass either a buffer or a base64 image directly into the POST convenience method. It comes back as a 400 bad request. To make it work I'm currently making a file out of it first and then feeding this to node-twitter. This works but I don't like it.

chrisdel101 avatar Nov 23 '18 23:11 chrisdel101

Unfortunately not @chrisdel101. I'd try asking on the StackOverflow post. I created the issue while trying to answer questions on StackOverflow and pay it forward. It looks like the repo hasn't had a commit to master since June 2017. I'd have a look at the conversation in #279 and consider the forked library there.

seanpoulter avatar Nov 24 '18 00:11 seanpoulter