-
Notifications
You must be signed in to change notification settings - Fork 110
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support FormData
#20
Comments
@ForbesLindesay take a look at mikeal/request. It does what you need with FormData, and has several nice examples. |
That's a server side library though, last I checked it wouldn't run on the client, and even if it does run on the client, What I'd like would be something where you could say: var request = http.request(options)
request.end(FormData) on the client. |
@ForbesLindesay I am curious. What exactly are you doing with the FormData If you are uploading in the browser you can already do that with jquery or My point is how would you write this on node using a feature of http that
|
OK, what I'm doing is using it to upload images to What I'm saying is I'd like to be able to have the one file look something like: var FD = FormData || require('form-data')
var hyperquest = require('hyperquest')
var concat = require('concat-stream')
module.exports = post
function post(file, clientID, callback) {
var fd = new FD()
fd.append('image', file)
var headers = fd.getHeaders()
headers.Authorization = 'Client-ID ' + clientID
var req = hyperquest.post('https://api.imgur.com/3/image.json', {headers: headers})
req.on('error', callback)
//not sure what this API call should look like
req.attachFormData(fd)
req.pipe(concat(function (res) { callback(null, res) }))
} |
see #43 |
has there been any work to support piping xhr2 files/buffers/etc into the request? Ran into this headache recently and it breaks in Firefox. |
@ForbesLindesay did you ever figure out how to get hyperquest working with FormData? |
no, I'm just using browser APIs for making requests on the browser. Helps keep the bundle small since I don't need node streams on the client anyway. |
Posting FormData can be done using something like:
However, I can see know way of handling
FormData
using the built inhttp
module.(see browserify/browserify#439)
The text was updated successfully, but these errors were encountered: