sailthru / sailthru-node-client

Sailthru Node.js client
http://docs.sailthru.com
MIT License
17 stars 15 forks source link

Note that node version 0.12 causes problems. #12

Closed Josh-Tilles closed 9 years ago

Josh-Tilles commented 9 years ago

As an example, I ran the following code:

var sailthru = require('sailthru-client').createSailthruClient(apiKey, apiSecret);
sailthru.apiPost('send', {template: 'Abandon-car', email: 'jtilles+fromMe@sailthru.com'}, function(response, err) {
   console.log('response:', response);
   console.log('err:', err);
});

When on Node 0.12.0 (and io.js, for that matter), I saw the following behavior:

$ node src/sail.js
Hello, world!
8 Mar 19:16:42 - sailthru-client 1.0.8 - POST Request
response: write after end
err: [Error: write after end]
8 Mar 19:16:57 - sailthru-client 1.0.8 - Status Code: 400
response: Unexpected token <
err: { statusCode: 0, error: 0, errormsg: 'Unexpected token <' }

When on Node 0.10.36, I instead see:

$ node src/sail.js
Hello, world!
8 Mar 19:21:42 - sailthru-client 1.0.8 - POST Request
8 Mar 19:21:42 - sailthru-client 1.0.8 - Status Code: 200
response: { email: 'jtilles+fromme@sailthru.com',
  send_id: 'VPzZhpdZEE9qdZUQ',
  template: 'Abandon-car',
  status: 'unknown',
  send_key: null }
err: undefined
robwil commented 9 years ago

You want to restrict to < 0.12 rather than fix the callback issue ? Are you worried there are other issues ?

Josh-Tilles commented 9 years ago

@robwil I definitely still want to fix the callback issue; I just think that this change is worth making independently. Like, even if we created a support/1.* branch (which would not contain the callback changes) I think this patch is worth keeping.

Josh-Tilles commented 9 years ago

I could just add this commit to the other PR. Just lemme know.

robwil commented 9 years ago

@MerelyAPseudonym sounds good to me, doing it in a separate change.

Josh-Tilles commented 9 years ago

@robwil so is that a +1? =)

robwil commented 9 years ago

+1

devinus commented 9 years ago

Are there any plans to fix this?

robwil commented 9 years ago

Closing PR since this has been fixed.