|
| 1 | += New Features |
| 2 | + |
| 3 | +* A response_content_type plugin has been added for more easily |
| 4 | + setting the content type of responses: |
| 5 | + |
| 6 | + When setting the content-type, you can pass either a string, which |
| 7 | + is used directly: |
| 8 | + |
| 9 | + response.content_type = "text/html" |
| 10 | + |
| 11 | + Or, if you have registered mime types when loading the plugin: |
| 12 | + |
| 13 | + plugin :response_content_type, mime_types: { |
| 14 | + plain: "text/plain", |
| 15 | + html: "text/html", |
| 16 | + pdf: "application/pdf" |
| 17 | + } |
| 18 | + |
| 19 | + You can use a symbol: |
| 20 | + |
| 21 | + response.content_type = :html |
| 22 | + |
| 23 | + If you would like to load all mime types supported by rack/mime, |
| 24 | + you can use the <tt>mime_types: :from_rack_mime</tt> option: |
| 25 | + |
| 26 | + plugin :response_content_type, mime_types: :from_rack_mime |
| 27 | + |
| 28 | + Note that you are unlikely to be using all of these mime types, |
| 29 | + so doing this will likely result in unnecessary memory usage. It |
| 30 | + is recommended to use a hash with only the mime types your |
| 31 | + application actually uses. |
| 32 | + |
| 33 | + To prevent silent failures, if you attempt to set the response |
| 34 | + type with a symbol, and the symbol is not recognized, a KeyError |
| 35 | + is raised. |
| 36 | + |
| 37 | +* The typecast_params plugin now includes typecast_query_params and |
| 38 | + typecast_body_params methods in addition to typecast_params. |
| 39 | + typecast_query_params deals with query string parameters (r.GET), |
| 40 | + and typecast_body_params deals with request body parameters |
| 41 | + (r.POST). |
| 42 | + |
| 43 | += Other Improvements |
| 44 | + |
| 45 | +* The sessions plugin now raises |
| 46 | + Roda::RodaPlugins::Sessions::CookieTooLarge if the total cookie |
| 47 | + size is over 4K. Previously, it only raised the exception if the |
| 48 | + cookie value was over 4K. Browsers enforce the limit on the total |
| 49 | + cookie size, not just the value, so this change prevents Roda |
| 50 | + from setting a cookie that a browser would ignore due to size |
| 51 | + restrictions. |
0 commit comments