Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 18 lines (16 sloc) 0.679 kb
ec8401f @Almad Initial transfer of language templates
Almad authored
1 <section name="nodejs">
2 <p class="ioDesc">In</p>
3 <pre class="incoming brush:js">
4 var request = require("request");
dd40e49 @Almad Adapt examples to new headers object
Almad authored
5 <% if @method is "GET" and not @headers: %>
ec8401f @Almad Initial transfer of language templates
Almad authored
6 request("<%= @apiUrl %><%= @url %>", function (error, response, body) {
7 <% else : %>
8 request({
9 url: "<%= @apiUrl %><%= @url %>",<% if @body: %>
3f721ee @zzen Better empty headers detection
zzen authored
10 body: <%= @helpers.escape @body.join('') %>,<% end %><% if @helpers.isNotEmpty @headers: %>
7378dd9 @zzen Fixed escaping of template headers
zzen authored
11 headers: {<%= ("#{@helpers.escape header}: #{@helpers.escape value}" for header,value of @headers).join(", ") %>}, <% end %>
ec8401f @Almad Initial transfer of language templates
Almad authored
12 method: "<%= @method.toUpperCase() %>"
13 }, function (error, response, body) {
14 <% end %> console.log("Reponse received", response);
15 });
16
17 </section>
Something went wrong with that request. Please try again.