Skip to content
Browse files

Process unjoined @body

  • Loading branch information...
1 parent dd40e49 commit 0a9af094dcb4c92458eadac4f343702bb8a6ce82 @Almad Almad committed Apr 11, 2012
Showing with 9 additions and 9 deletions.
  1. +1 −1 curl.html
  2. +1 −1 nodejs.html
  3. +3 −3 python.html
  4. +1 −1 raw.html
  5. +3 −3 ruby.html
View
2 curl.html
@@ -3,7 +3,7 @@
<pre class="incoming brush:shell">
curl --include<% if @headers: %><% for header,value of @headers: %> --header "<%= header %>: <%= value %>"<% end %> \
<% end %><% if @method isnt 'GET': %> --request <%= @method %> \
- <% end %><% if @body: %> --data <%= @helpers.escape @body %> \
+ <% end %><% if @body: %> --data <%= @helpers.escape @body.join('') %> \
<% end %> "<%= @apiUrl %><%= @url %>"
</pre>
</section>
View
2 nodejs.html
@@ -7,7 +7,7 @@
<% else : %>
request({
url: "<%= @apiUrl %><%= @url %>",<% if @body: %>
- body: <%= @helpers.escape @body %>,<% end %><% if @headers: %>
+ body: <%= @helpers.escape @body.join('') %>,<% end %><% if @headers: %>
headers: {<%= ('"'+header+'": "'+value+'"' for header,value of @headers).join(", ") %>}, <% end %>
method: "<%= @method.toUpperCase() %>"
}, function (error, response, body) {
View
6 python.html
@@ -5,9 +5,9 @@
<% if @contentType is "application/json": %>from json import dumps
<% else if @contentType is "application/x-www-form-urlencoded": %>from urllib import urlencode
<% end %>
-<% if @contentType is "application/x-www-form-urlencoded": %>values = urlencode(<%= @body %>)
-<% else if @contentType is "application/json": %>values = dumps(<%= @body %>)
-<% else if @method isnt 'GET': %>values = <%= @helpers.escape @body %>
+<% if @contentType is "application/x-www-form-urlencoded": %>values = urlencode(<%= @body.join('') %>)
+<% else if @contentType is "application/json": %>values = dumps(<%= @body.join('') %>)
+<% else if @method isnt 'GET': %>values = <%= @helpers.escape @body.join('') %>
<% end %><% if @headers: %>headers = {<%= ('"'+header+'": "'+value+'"' for header,value of @headers).join(", ") %>}
<% end %>request = Request("<%= @apiUrl %><%= @url %>"<% if @method in ['POST', 'PUT'] : %>, data=values<% end %><% if @headers?.length: %>, headers=headers<% end %>)
<% if @method not in ['GET', 'POST'] : %>request.get_method = lambda: '<%= @method %>'
View
2 raw.html
@@ -1,5 +1,5 @@
<section name="raw">
<p class="ioDesc">In</p>
<pre class="incoming"><%= "#{header}: #{value}\n" for header, value of @headers %></pre>
- <pre class="incoming<%= @helpers.getContentTypeBrush @headers %>"><%= @body %></pre>
+ <pre class="incoming<%= @helpers.getContentTypeBrush @headers %>"><%= @body.join('\n') %></pre>
</section>
View
6 ruby.html
@@ -3,9 +3,9 @@
<pre class="incoming brush:ruby">
require 'rest_client'
-<% if @contentType is "application/x-www-form-urlencoded": %>values = CGI::escape(<%= @helpers.escape @body %>)
-<% else if @contentType is "application/json": %>values = <%= @helpers.escape @body %>
-<% else if @body: %>values = <%= @helpers.escape @body %>
+<% if @contentType is "application/x-www-form-urlencoded": %>values = CGI::escape(<%= @helpers.escape @body.join('') %>)
+<% else if @contentType is "application/json": %>values = <%= @helpers.escape @body.join('') %>
+<% else if @body: %>values = <%= @helpers.escape @body.join('') %>
<% end %><% if @headers: %>headers = {<%= ['"'+@helpers.rubyKey header+'" => "'+value+'"' for header,value of @headers].join(", ") %>}
<% end %>response = RestClient.<%= @method.toLowerCase() %> "<%= @apiUrl %><%= @url %>"<% if @body: %>, values<% end %><% if @headers?.length: %>, headers<% end %>
</pre>

0 comments on commit 0a9af09

Please sign in to comment.
Something went wrong with that request. Please try again.