Skip to content

Commit 31e6409

Browse files
authored
Bug Fix: Allow API Authentication to use HTTP
There is a bug where the "http" option cannot be selected (when selected and saved, it resets to https). This fixes that by properly setting the config property.
2 parents f5e4cb6 + 9a7a1f9 commit 31e6409

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

tulip_api_auth.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
<input type="text" id="node-config-input-name" placeholder="Name" />
5252
</div>
5353
<div class="form-row">
54-
<label for="node-input-protocol"><i class="fa fa-globe"></i> Protocol</label>
55-
<select id="node-input-protocol">
54+
<label for="node-config-input-protocol"><i class="fa fa-globe"></i> Protocol</label>
55+
<select id="node-config-input-protocol">
5656
<option value="https">https</option>
5757
<option value="http">http</option>
5858
</select>

tulip_machine_attribute.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ module.exports = function (RED) {
33

44
const request = require('request');
55
const https = require('https');
6+
const http = require('http');
7+
const httpLibs = {
8+
http,
9+
https,
10+
}
611
const { v4: uuidv4 } = require('uuid');
712

813
// Tulip API node
@@ -15,7 +20,7 @@ module.exports = function (RED) {
1520
this.deviceInfo = JSON.parse(config.deviceInfo);
1621
this.payloadSource = config.payloadSource;
1722
this.payloadType = config.payloadType;
18-
this.agent = new https.Agent({
23+
this.agent = new httpLibs[apiAuthNode.protocol].Agent({
1924
keepAlive: config.keepAlive,
2025
keepAliveMsecs: config.keepAliveMsecs,
2126
});

0 commit comments

Comments
 (0)