Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 23 lines (22 sloc) 0.832 kB
5e71148 @Almad Add classes so bad selector engines are worky
Almad authored
1 <section name="nodejs" class="nodejs">
b62198c @zdne 'In' (input) renamed 'to' Request
zdne authored
2 <p class="ioDesc">Request</p>
3637277 @kuba-kubula PRE with CODE element with class language
kuba-kubula authored
3 <pre class="incoming"><code class="language-javascript">var request = require("request");
dd40e49 @Almad Adapt examples to new headers object
Almad authored
4 <% if @method is "GET" and not @headers: %>
ec8401f @Almad Initial transfer of language templates
Almad authored
5 request("<%= @apiUrl %><%= @url %>", function (error, response, body) {
6 <% else : %>
7 request({
ee2752c @kuba-kubula Fixing rendering of cURL multiline body, new-lines in PHP and Python,…
kuba-kubula authored
8 url: "<%= @apiUrl %><%= @url %>",
9 <% if @body: %>
10 body: <%= @helpers.escape @body %>,
11 <% end %>
12 <% if @helpers.isNotEmpty @headers: %>
13 headers: {<%= ("#{@helpers.escape header}: #{@helpers.escape value}" for header,value of @headers).join(", ") %>},
14 <% end %>
ec8401f @Almad Initial transfer of language templates
Almad authored
15 method: "<%= @method.toUpperCase() %>"
16 }, function (error, response, body) {
ee2752c @kuba-kubula Fixing rendering of cURL multiline body, new-lines in PHP and Python,…
kuba-kubula authored
17 <% end %>
2a6e698 @mamund modify templates to improve feedback
mamund authored
18 console.log("Status", response.statusCode);
19 console.log("Headers", JSON.stringify(response.headers));
20 console.log("Reponse received", body);
3637277 @kuba-kubula PRE with CODE element with class language
kuba-kubula authored
21 });</code></pre>
ec8401f @Almad Initial transfer of language templates
Almad authored
22 </section>
Something went wrong with that request. Please try again.