HaxeFoundation / hxnodejs

Haxe externs for working with node.js
MIT License
171 stars 63 forks source link

HTTPS requests without options generates invalid code #170

Closed blue112 closed 4 years ago

blue112 commented 4 years ago

Using this code:

js.node.Https.request(path, function(res:js.node.http.IncomingMessage) {}).end();

Generates:

js_node_Https.request(path, null ,function(res) {}).end();

The null here breaks the code and the https request is not sent. The correct code is :

js_node_Https.request(path ,function(res) {}).end();

A workaround is to use all three parameters with valid inputs:

js.node.Https.request(path, {}, function(res:js.node.http.IncomingMessage) {}).end();

Using hxnodejs with haxelib 12.1.0, and nodejs v12.18.2

Gama11 commented 4 years ago

Hm, good catch, and looks like get() has the same issue. A bit annoying, but we can fix this by adding more overloads.