Commit 1ba4664
Don't escape JSON when unnecessary
When `render json:` is used in a controller, and there's no callback
option (used for JSONP), the resulting JSON document doesn't need to be
HTML-safe (no need to escape HTML entities) or embeddable into
JavaScript (no need to escape U+2028 and U+2029).
This both saves a costly operation and renders cleaner JSON.
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>1 parent dd44466 commit 1ba4664
File tree
2 files changed
+22
-1
lines changed- actionpack
- lib/action_controller/metal
- test/controller
2 files changed
+22
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
156 | 157 | | |
157 | 158 | | |
158 | 159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
49 | 57 | | |
50 | 58 | | |
51 | 59 | | |
| |||
106 | 114 | | |
107 | 115 | | |
108 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
109 | 129 | | |
110 | 130 | | |
111 | 131 | | |
| |||
137 | 157 | | |
138 | 158 | | |
139 | 159 | | |
140 | | - | |
| 160 | + | |
141 | 161 | | |
142 | 162 | | |
0 commit comments