Skip to content

Commit 2fca809

Browse files
committed
Added support for using a proxy server
1 parent 1d08e9e commit 2fca809

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/api-client.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ class ApiClient {
1818
* @param {string} databaseId - ID of your database
1919
* @param {string} secretToken - Corresponding secret token
2020
* @param {boolean} alwaysUseHttps - If true, all requests are sent using HTTPS (default: false)
21+
* @param {Object} options - Other custom options
2122
*/
22-
constructor (databaseId, token, alwaysUseHttps) {
23+
constructor (databaseId, token, alwaysUseHttps, options) {
2324
this.databaseId = databaseId;
2425
this.token = token;
2526
this.alwaysUseHttps = alwaysUseHttps;
2627
this.baseUri = process.env.RAPI_URI || 'rapi.recombee.com';
28+
this.options = options || {};
2729
}
2830

2931
/**
@@ -46,6 +48,9 @@ class ApiClient {
4648
json: true
4749
};
4850

51+
if (this.options.proxy)
52+
options.proxy = this.options.proxy;
53+
4954
if (request.bodyParameters())
5055
options.body = request.bodyParameters();
5156

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "recombee-api-client",
3-
"version": "1.3.2",
3+
"version": "1.3.3",
44
"description": "Node.js client (SDK) for easy use of the Recombee recommendation API",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)