mscdex / connect-busboy

Connect middleware for busboy
MIT License
155 stars 25 forks source link

Example not working? #6

Closed chmorgan closed 10 years ago

chmorgan commented 10 years ago

Tried using the example in the Readme, had to add some boilerplate, install express etc, but I'm seeing errors when posting:

[cmorgan@homepc busboy_test]$ node testapp.js 
TypeError: Cannot call method 'on' of undefined
    at app.use.busboy.immediate (/home/cmorgan/busboy_test/testapp.js:11:14)
    at Layer.handle [as handle_request] (/home/cmorgan/busboy_test/node_modules/express/lib/router/layer.js:76:5)
    at trim_prefix (/home/cmorgan/busboy_test/node_modules/express/lib/router/index.js:263:13)
    at /home/cmorgan/busboy_test/node_modules/express/lib/router/index.js:230:9
    at Function.proto.process_params (/home/cmorgan/busboy_test/node_modules/express/lib/router/index.js:305:12)
    at /home/cmorgan/busboy_test/node_modules/express/lib/router/index.js:221:12
    at Function.match_layer (/home/cmorgan/busboy_test/node_modules/express/lib/router/index.js:288:3)
    at next (/home/cmorgan/busboy_test/node_modules/express/lib/router/index.js:182:10)
    at /home/cmorgan/busboy_test/node_modules/connect-busboy/index.js:14:14
    at Layer.handle [as handle_request] (/home/cmorgan/busboy_test/node_modules/express/lib/router/layer.js:76:5)
^C[cmorgan@homepc busboy_test]$ 

It looks like req doesn't have a .busboy element. Tried with expressjs 3.x and 4.x.

mscdex commented 10 years ago

Can you show your code?

chmorgan commented 10 years ago

I put together what I have here, https://github.com/chmorgan/connect-busboy-example

Maybe I'm misunderstanding how to even use an http post because the curl operation works but POSTMAN with raw text doesn't.

mscdex commented 10 years ago

Did you try with the postman settings shown here?

If you are sending raw data (and it is valid multipart or urlencoded data), then you need to make sure you explicitly set the correct Content-Type.