Skip to content
This repository has been archived by the owner on May 2, 2020. It is now read-only.

Commit

Permalink
Fix web ui view for headers
Browse files Browse the repository at this point in the history
  • Loading branch information
rwojsznis committed Apr 23, 2015
1 parent 3f52089 commit c3a0a00
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
## 0.1.0alpha2

- web ui parse headers fix

## 0.1.0alpha

**Backward incompatible changes**
Expand Down
2 changes: 1 addition & 1 deletion lib/rack/request_police/version.rb
@@ -1,5 +1,5 @@
module Rack
module RequestPolice
VERSION = "0.1.0alpha"
VERSION = "0.1.0alpha2"
end
end
8 changes: 7 additions & 1 deletion lib/rack/request_police/web_helpers.rb
Expand Up @@ -36,9 +36,15 @@ def escape(text)

def pretty_parse(post_data)
JSON.pretty_generate(JSON.parse(post_data))
rescue JSON::ParserError
rescue JSON::ParserError, JSON::GeneratorError
post_data
end

def pretty_parse_hash(hash)
JSON.pretty_generate(hash)
rescue JSON::GeneratorError
hash.to_s
end
end
end
end
2 changes: 1 addition & 1 deletion web/views/index.erb
Expand Up @@ -84,7 +84,7 @@
<% if log.headers %>
<h4>Headers:</h4>
<pre>
<%= escape(pretty_parse(log.headers)) %>
<%= escape(pretty_parse_hash(log.headers)) %>
</pre>
<% end %>
Expand Down

0 comments on commit c3a0a00

Please sign in to comment.