3

I have a restify server receiving a POST then it will reply with a POST call. I'm using the string client module. Below is the code:

var restify = require('restify');

var client = restify.createStringClient({
   url: 'https://xyz.com'
 });

var postdata = {
  ...
 };

 client.basicAuth('username','pass');

 client.post('/somepath',postdata,
            function(err, req, res, data) {
                if(err) ... else { ... };
                //should the close method be called here??
      });

The POST was successful but when I tested it in REPL, it appears the process never terminates. The seems to indicate the connection is still open. Should the connection be closed in the callback?

Any pointers would be greatly appreciated. Thx.

4

1 回答 1

4

Restify StringClient inherits from HttpClient... which has a close() method... did you try it?

于 2013-04-24T16:41:04.423 回答