arei / node-untappd

NodeJS API for Untappd

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HTTPS/443 not working

sillygwailo opened this issue · comments

When running debug mode on both my laptop and remote server, I get this:

 node-untappd: get : /v4/beer/info/44533?client_id=MY_CLIENT_ID&client_secret=MY_CLIENT_SECRET
 { client_id: 'MY_CLIENT_ID',
   client_secret: 'MY_CLIENT_ID' }
 null
 node-untappd: error:  { '0': { [Error: socket hang up] code: 'ECONNRESET' } }

If I change the port in the module from 443 to 80 (not what you intended here) it works:

node-untappd: get : /v4/beer/info/44533?client_id=MY_CLIENT_ID&client_secret=MY_CLIENT_SECRET
{ client_id: 'MY_CLIENT_ID',
  client_secret: 'MY_CLIENT_SECRET' }
null
node-untappd: data:  14064
node-untappd: data:  1448
node-untappd: data:  18824
node-untappd: data:  1448
node-untappd: data:  17376
node-untappd: data:  7240
node-untappd: data:  1448
node-untappd: data:  13832
node-untappd: end:  0
{ meta: 
   { code: 200,
     response_time: { time: 0.528, measure: 'seconds' },
     init_time: { time: 0.007, measure: 'seconds' } },
  notifications: [],
  [...rest of the object...]

(Client ID and secret obscured for obvious reasons.)

My code is, essentially, just

console.log(JSON.parse(body));

Version 0.3.1 is now available which fixes this issue.

Basically I had changed the port but not changed to use the HTTPS.request method, so it was still doing http.