Skip to content

Conversation

@jywarren
Copy link

@jywarren jywarren commented Jun 3, 2015

This isn't ready.

I can't get this to work when I pipe a string "Hello world." to it, like:

echo "Hello world!" | ./push --url data.sparkfun.com --public_key lzELagraWDiMMRra0V6Q --private_key XXXXXXXXXX --field_name misc

This is an incomplete and dissatisfying adaptation for POST requests, which I hope will solve this bug. But the http library is poorly or not documented (or I can't find it) so I'm thinking we ought to switch to the better-supported request library?

https://github.com/request/request

@jywarren
Copy link
Author

jywarren commented Jun 3, 2015

This should be merged after #1 if at all.

@rjcorwin
Copy link
Member

That there http module is the one that comes with core nodejs. Docs over here. I actually was using the request module at first, can't remember exactly why I dropped it. Maybe for the sake of not adding a dependency that was easily done by using the http lib. However, if that http library is being squirely with post, I'm fine with adding request back in. It is pretty standard.

@jywarren
Copy link
Author

I rebased with merge, but am now getting an error:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: socket hang up
    at createHangUpError (http.js:1472:15)
    at Socket.socketOnEnd [as onend] (http.js:1568:23)
    at Socket.g (events.js:180:16)
    at Socket.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:919:16
    at process._tickCallback (node.js:419:13)

This makes me want a test suite, since testing just this component is a little touch. I opened open-eio#3 to suggest this.

I think the key was this line:

postOptions[options.field_name] = options.data;

Somehow that kludge was the only way I could get it to work. POST is kinda irrelevant here, but anyways the goal here is to get it to accept a piped string, and the library is just a means to try to get that to work, as in open-eio#1

I guest POST is not a bad idea in general, though, as we begin to send very large datasets, in theory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants