<commit_before><!--
  Copyright 2013 IBM Corp.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<script type="text/x-red" data-template-name="http in">
    <div class="form-row">
        <label for="node-input-method"><i class="icon-tasks"></i> Method</label>
        <select type="text" id="node-input-method" style="width: 150px;">
        <option value="get">GET</option>
        <option value="post">POST</option>
        <option value="put">PUT</option>
        <option value="delete">DELETE</option>
        </select>
    </div>
    <div class="form-row">
        <label for="node-input-topic"><i class="icon-globe"></i> url</label>
        <input type="text" id="node-input-url" placeholder="/url">
    </div>
    <div class="form-row">
        <label for="node-input-name"><i class="icon-tag"></i> Name</label>
        <input type="text" id="node-input-name" placeholder="Name">
    </div>
</script>

<script type="text/x-red" data-help-name="http in">
	<p>Provides an input node for http requests, allowing the creation of simple web services.</p>
	<p>The resulting message has the following properties:
	    <ul>
	        <li>msg.req : <a href="http://expressjs.com/api.html#req">http request</a></li>
	        <li>msg.res : <a href="http://expressjs.com/api.html#res">http response</a></li>
	    </ul>
	</p>
	<p>For POST/PUT requests, the body is available under <code>msg.req.body</code>. This
	   uses the <a href="http://expressjs.com/api.html#bodyParser">Express bodyParser middleware</a> to parse the content to a JSON object.
    </p>
	<p>
	   By default, this expects the body of the request to be url encoded:
	   <pre>foo=bar&amp;this=that</pre>
    </p>
	<p>
	   To send JSON encoded data to the node, the content-type header of the request must be set to
	   <code>application/json</code>.
	</p>
	<p>
	   <b>Note: </b>This node does not send any response to the http request. This should be done with
	   a subsequent HTTP Response node, or Function node.
	   In the case of a Function node, the <a href="http://expressjs.com/api.html#res">Express response documentation</a>
	   describes how this should be done. For example:
	   <pre>msg.res.send(200, 'Thanks for the request ');<br/>return msg;</pre>
    </p>

</script>

<script type="text/javascript">
    RED.nodes.registerType('http in',{
        category: 'input',
        color:"rgb(231, 231, 174)",
        defaults: {
            name: {value:""},
            url: {value:"",required:true},
            method: {value:"get",required:true}
        },
        inputs:0,
        outputs:1,
        icon: "white-globe.png",
        label: function() {
            return this.name||(this.url?("["+this.method+"] "+this.url):"http");
        },
        labelStyle: function() {
            return this.name?"node_label_italic":"";
        }
    });
</script>

<script type="text/x-red" data-template-name="http response">
    <div class="form-row">
        <label for="node-input-name"><i class="icon-tag"></i> Name</label>
        <input type="text" id="node-input-name" placeholder="Name">
    </div>
    <div class="form-tips">The messages sent to this node <b>must</b> originate from an <i>http input</i> node</div>
</script>

<script type="text/x-red" data-help-name="http response">
	<p>Sends responses back to http requests received from an HTTP Input node.</p>
	<p>The response can be customised using the following message properties:</p>
	<ul>
	    <li><code>payload</code> is sent as the body of the reponse</li>
	    <li><code>statusCode</code>, if set, is used as the response status code (default: 200)</li>
	    <li><code>headers</code>, if set, should be an object containing field/value
	    pairs to be added as response headers.</li>
	</ul>
</script>

<script type="text/javascript">
    RED.nodes.registerType('http response',{
        category: 'output',
        color:"rgb(231, 231, 174)",
        defaults: {
            name: {value:""}
        },<commit_msg>Add httpRoot tip to http node<commit_after><!--
  Copyright 2013 IBM Corp.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<script type="text/x-red" data-template-name="http in">
    <div class="form-row">
        <label for="node-input-method"><i class="icon-tasks"></i> Method</label>
        <select type="text" id="node-input-method" style="width: 150px;">
        <option value="get">GET</option>
        <option value="post">POST</option>
        <option value="put">PUT</option>
        <option value="delete">DELETE</option>
        </select>
    </div>
    <div class="form-row">
        <label for="node-input-topic"><i class="icon-globe"></i> url</label>
        <input type="text" id="node-input-url" placeholder="/url">
    </div>
    <div class="form-row">
        <label for="node-input-name"><i class="icon-tag"></i> Name</label>
        <input type="text" id="node-input-name" placeholder="Name">
    </div>
    <div id="node-input-tip" class="form-tips">The url will be relative to <code><span id="node-input-path"></span></code>.</div>
</script>

<script type="text/x-red" data-help-name="http in">
	<p>Provides an input node for http requests, allowing the creation of simple web services.</p>
	<p>The resulting message has the following properties:
	    <ul>
	        <li>msg.req : <a href="http://expressjs.com/api.html#req">http request</a></li>
	        <li>msg.res : <a href="http://expressjs.com/api.html#res">http response</a></li>
	    </ul>
	</p>
	<p>For POST/PUT requests, the body is available under <code>msg.req.body</code>. This
	   uses the <a href="http://expressjs.com/api.html#bodyParser">Express bodyParser middleware</a> to parse the content to a JSON object.
    </p>
	<p>
	   By default, this expects the body of the request to be url encoded:
	   <pre>foo=bar&amp;this=that</pre>
    </p>
	<p>
	   To send JSON encoded data to the node, the content-type header of the request must be set to
	   <code>application/json</code>.
	</p>
	<p>
	   <b>Note: </b>This node does not send any response to the http request. This should be done with
	   a subsequent HTTP Response node, or Function node.
	   In the case of a Function node, the <a href="http://expressjs.com/api.html#res">Express response documentation</a>
	   describes how this should be done. For example:
	   <pre>msg.res.send(200, 'Thanks for the request ');<br/>return msg;</pre>
    </p>

</script>

<script type="text/javascript">
    RED.nodes.registerType('http in',{
        category: 'input',
        color:"rgb(231, 231, 174)",
        defaults: {
            name: {value:""},
            url: {value:"",required:true},
            method: {value:"get",required:true}
        },
        inputs:0,
        outputs:1,
        icon: "white-globe.png",
        label: function() {
            if (this.name) {
                return this.name;
            } else if (this.url) {
                var root = document.location.pathname.slice(0,-1);
                root += this.url;
                return "["+this.method+"] "+root;
            } else {
                return "http";
            }
        },
        labelStyle: function() {
            return this.name?"node_label_italic":"";
        },
        oneditprepare: function() {
            var root = document.location.pathname.slice(0,-1);
            if (root == "") {
                $("#node-input-tip").hide();
            } else {
                $("#node-input-path").html(root);
                $("#node-input-tip").show();
            }
            //document.getElementById("node-config-wsdocpath").innerHTML=
        }

    });
</script>

<script type="text/x-red" data-template-name="http response">
    <div class="form-row">
        <label for="node-input-name"><i class="icon-tag"></i> Name</label>
        <input type="text" id="node-input-name" placeholder="Name">
    </div>
    <div class="form-tips">The messages sent to this node <b>must</b> originate from an <i>http input</i> node</div>
</script>

<script type="text/x-red" data-help-name="http response">
	<p>Sends responses back to http requests received from an HTTP Input node.</p>
	<p>The response can be customised using the following message properties:</p>
	<ul>
	    <li><code>payload</code> is sent as the body of the reponse</li>
	    <li><code>statusCode</code>, if set, is used as the response status code (default: 200)</li>
	    <li><code>headers</code>, if set, should be an object containing field/value
	    pairs to be added as response headers.</li>
	</ul>
</script>

<script type="text/javascript">
    RED.nodes.registerType('http response',{
        category: 'output',
        color:"rgb(231, 231, 174)",
        defaults: {
            name: {value:""}
        },
{'fraction_non_alphanumeric': 0.15502995248915513, 'fraction_numerical': 0.008056186738277215, 'mean_word_length': 2.8670127795527156, 'pattern_counts': {'":': 2, '<': 229, '<?xml version=': 0, '>': 229, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7363674', 'n_tokens_mistral': 3031, 'n_tokens_neox': 2919, 'n_words': 886}