Skip to content

Commit

Permalink
helpers.escape is JSON.stringify, thus is surrounded with "
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba-kubula committed Aug 6, 2014
1 parent 29e7f19 commit 4e2870c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
14 changes: 7 additions & 7 deletions csharp.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
request.Method = "<%= @method.toUpperCase() %>";
<% if @headers and @helpers.isNotEmpty @headers: %>
<% for header, value of @headers: %><% header = header.toLowerCase() %>
<% if header in ['accept', 'connection', 'date', 'expect', 'host', 'range', 'referer'] : %>request.<%- header.charAt(0).toUpperCase() %><%- header.substring(1).toLowerCase() %> = "<%= @helpers.escape value %>";
<% else if header is 'content-length': %>request.ContentLength = "<%= @helpers.escape value %>";
<% else if header is 'content-type': %>request.ContentType=<%= @helpers.escape value %>;
<% else if header is 'if-modified-since': %>request.IfModifiedSince = "<%= @helpers.escape value %>";
<% else if header is 'transfer-encoding': %>request.TransferEncoding = "<%= @helpers.escape value %>";
<% else if header is 'user-agent': %>request.UserAgent = "<%= @helpers.escape value %>";
<% else if header is 'proxy-connection': %>request.ProxyConnection = "<%= @helpers.escape value %>";
<% if header in ['accept', 'connection', 'date', 'expect', 'host', 'range', 'referer'] : %>request.<%- header.charAt(0).toUpperCase() %><%- header.substring(1).toLowerCase() %> = <%= @helpers.escape value %>;
<% else if header is 'content-length': %>request.ContentLength = <%= @helpers.escape value %>;
<% else if header is 'content-type': %>request.ContentType = <%= @helpers.escape value %>;
<% else if header is 'if-modified-since': %>request.IfModifiedSince = <%= @helpers.escape value %>;
<% else if header is 'transfer-encoding': %>request.TransferEncoding = <%= @helpers.escape value %>;
<% else if header is 'user-agent': %>request.UserAgent = <%= @helpers.escape value %>;
<% else if header is 'proxy-connection': %>request.ProxyConnection = <%= @helpers.escape value %>;
<% else: %>request.Headers.Add(<%= @helpers.escape header %>, <%= @helpers.escape value %>);
<% end %>
<% end %>
Expand Down
17 changes: 7 additions & 10 deletions vb.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@
<p class="ioDesc">Request</p>
<pre class="incoming"><code class="language-vb">Dim request = TryCast(System.Net.WebRequest.Create("<%= @apiUrl %><%= @url %>"), System.Net.HttpWebRequest)
request.Method = "<%= @method.toUpperCase() %>"
<% if @contentType: %>
request.ContentType = "<%= @contentType %>"
<% end %>
<% if @headers and @helpers.isNotEmpty @headers: %>
<% for header, value of @headers: %><% header = header.toLowerCase() %>
<% if header in ['accept', 'connection', 'date', 'expect', 'host', 'range', 'referer']: %>request.<%- header.charAt(0).toUpperCase() %><%- header.substring(1).toLowerCase() %> = "<%= @helpers.escape value %>"
<% else if header is 'content-length': %>request.ContentLength = "<%= @helpers.escape value %>"
<% else if header is 'content-type': %>request.ContentType=<%= @helpers.escape value %>
<% else if header is 'if-modified-since': %>request.IfModifiedSince = "<%= @helpers.escape value %>"
<% else if header is 'transfer-encoding': %>request.TransferEncoding = "<%= @helpers.escape value %>"
<% else if header is 'user-agent': %>request.UserAgent = "<%= @helpers.escape value %>"
<% else if header is 'proxy-connection': %>request.ProxyConnection = "<%= @helpers.escape value %>"
<% if header in ['accept', 'connection', 'date', 'expect', 'host', 'range', 'referer']: %>request.<%- header.charAt(0).toUpperCase() %><%- header.substring(1).toLowerCase() %> = <%= @helpers.escape value %>
<% else if header is 'content-length': %>request.ContentLength = <%= @helpers.escape value %>
<% else if header is 'content-type': %>request.ContentType = <%= @helpers.escape value %>
<% else if header is 'if-modified-since': %>request.IfModifiedSince = <%= @helpers.escape value %>
<% else if header is 'transfer-encoding': %>request.TransferEncoding = <%= @helpers.escape value %>
<% else if header is 'user-agent': %>request.UserAgent = <%= @helpers.escape value %>
<% else if header is 'proxy-connection': %>request.ProxyConnection = <%= @helpers.escape value %>
<% else: %>request.Headers.Add(<%= @helpers.escape header %>, <%= @helpers.escape value %>)
<% end %>
<% end %>
Expand Down

0 comments on commit 4e2870c

Please sign in to comment.