Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@ Odoo.prototype.connect = function (cb) {
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Content-Length': json.length
'Content-Length': json.length,
'host': this.host
}
};

var self = this;

var req = http.request(options, function (res) {
var requestClient;
if (this.port === 443) requestClient = https;
else requestClient = http;

var req = requestClient.request(options, function (res) {
var response = '';

res.setEncoding('utf8');
Expand Down Expand Up @@ -203,7 +208,9 @@ Odoo.prototype._request = function (path, params, callback) {
}
};

var client = jayson.client.http(options);
var client;
if (this.port === 443) client = jayson.client.https(options);
else client = jayson.client.http(options);

client.request('call', params, function (e, err, res) {
if (e || err) {
Expand Down