I've implemented a http server parsing POST with the help from http://blog.thekfactor.info/posts/an-introduction-to-node-js-and-handling-post-requests/ (simply I don't want use express.)
However, what I got has
[2013-10-10 10:27:29.670] [INFO] console - ------WebKitFormBoundaryMjfXHTTJYUdOInJ4 Content-Disposition: form-data; name="route"
connector.sgtrackHandler.log ------WebKitFormBoundaryMjfXHTTJYUdOInJ4 Content-Disposition: form-data; name="body"
{"appid":"1234","event":"test","params":{}} ------WebKitFormBoundaryMjfXHTTJYUdOInJ4--
[2013-10-10 10:27:29.671] [INFO] console - { '------ WebKitFormBoundaryMjfXHTTJYUdOInJ4\r\nContent-Disposition: form-data; name': '"route"\r\n\r\nconnector.sgtrackHandler.log\r\n------WebKitFormBoundaryMjfXHTTJYUdOInJ4\r\nContent-Disposition: form-data; name="body"\r\n\r\n{"appid":"1234","event":"test","params":{}}\r\n------WebKitFormBoundaryMjfXHTTJYUdOInJ4--\r\n' }
I cannot handle the such multipart form WebKitFormBoundaryMjfXHTTJYUdOInJ4...any idea?
The code you're referring to parses application/x-www-form-urlencoded
, whereas what's being posted is multipart/form-data
, as defined in RFC2388.
To make it easier on yourself, you can use formidable
(which Express also uses).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With