Add Binary paylaod option to Http request node

Also add JSON parse option to output
Allow user to select override using msg.method to stop getting warning.
Fix to close #399
This commit is contained in:
Dave C-J
2014-12-09 14:40:03 +00:00
parent 6fc3aab907
commit 27ef7d972f
2 changed files with 40 additions and 10 deletions

View File

@@ -91,6 +91,7 @@
<option value="POST">POST</option>
<option value="PUT">PUT</option>
<option value="DELETE">DELETE</option>
<option value="use">- set by msg.method -</option>
</select>
</div>
<div class="form-row">
@@ -100,7 +101,7 @@
<div class="form-row">
<label>&nbsp;</label>
<input type="checkbox" id="node-input-useAuth" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-useAuth" style="width: 70%;">Use basic authentication?</label>
<label for="node-input-useAuth" style="width: 70%;">Use basic authentication ?</label>
</div>
<div class="form-row node-input-useAuth-row">
<label for="node-input-user"><i class="fa fa-user"></i> Username</label>
@@ -110,10 +111,19 @@
<label for="node-input-password"><i class="fa fa-lock"></i> Password</label>
<input type="password" id="node-input-password">
</div>
<div class="form-row">
<label for="node-input-ret"><i class="fa fa-arrow-left"></i> Return</label>
<select type="text" id="node-input-ret" style="width:72%;">
<option value="txt">a UTF-8 string</option>
<option value="bin">a binary buffer</option>
<option value="obj">a parsed JSON object</option>
</select>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-tips" id="tip-json" hidden>Tip: If the JSON parse fails the fetched string is returned as-is.</div>
</script>
<script type="text/x-red" data-help-name="http request">
@@ -212,6 +222,7 @@
defaults: {
name: {value:""},
method:{value:"GET"},
ret: {value:"txt"},
url:{value:""},
//user -> credentials
//pass -> credentials
@@ -248,6 +259,14 @@
$('#node-input-password').val('');
}
});
},
$("#node-input-ret").change(function() {
if ($("#node-input-ret").val() === "obj") {
$("#tip-json").show();
} else {
$("#tip-json").hide();
}
});
}
});
</script>