Permalink
Browse files

Made default values for requestCookies {} instead of undefined.

  • Loading branch information...
1 parent 097086e commit 9149f1db0e557addd67b1becfb597f510639d559 @cskr committed Nov 4, 2010
Showing with 9 additions and 11 deletions.
  1. +8 −10 examples/cookies/index.html
  2. +1 −1 grasshopper/lib/renderer.js
@@ -8,16 +8,14 @@
<input name="value" />
<input type="submit" value="Set Cookie" />
</form>
- <% if(cookies) { %>
- <h1>Current Cookies</h1>
+ <h1>Current Cookies</h1>
- <table>
- <% for(cookie in cookies) { %>
- <tr>
- <td style="font-weight: bold"><%= cookie %>: </td><td><%= cookies[cookie] %></td>
- </tr>
- <% } %>
- </table>
- <% } %>
+ <table>
+ <% for(cookie in cookies) { %>
+ <tr>
+ <td style="font-weight: bold"><%= cookie %>: </td><td><%= cookies[cookie] %></td>
+ </tr>
+ <% } %>
+ </table>
</body>
</html>
@@ -78,8 +78,8 @@ function RequestContext(request, response, params) {
};
var cookieLine = request.headers['cookie'];
+ this.requestCookies = {};
if(cookieLine) {
- this.requestCookies = {};
var cookies = cookieLine.split('; ');
for(var i = 0; i < cookies.length; i++) {
var cookieParts = cookies[i].split('=');

0 comments on commit 9149f1d

Please sign in to comment.