1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

8 commits

Author SHA1 Message Date
John Hawthorn
b5e8942c95 Raise exception when building invalid mime type
This allows mime types in the form text/html, text/*, or */*

This required a few minor test/code changes where previously nil was
used as a mime string.
2019-03-14 11:33:48 -07:00
Alireza Bashiri
9b51ee9f92 Prevent RequestEncoder#encode_params to parse falsey params
When a `get` method called with `as: :json` and `params: nil` or
`params: false` (explicitly or implicitly)
`RequestEncoder#encode_params` converts it into a `null` or `false`
value which includes a unexpected `null=` or `false` query string into
request URL. From now on `RequestEncoder#encode_params` checks whether
`params` is nil or not otherwise returns.

Move down `nil` conversion guard


Update CHANGELOG.md
2018-07-20 15:18:49 +04:30
Kir Shatrov
dfcc766163 Use frozen string literal in actionpack/ 2017-07-29 14:02:40 +03:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590, reversing
changes made to afb66a5a59.
2017-07-02 02:15:17 +09:30
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Kasper Timm Hansen
143fc87cbf Remove default argument value.
Wrongly added when fixing the request path wrangling.
2016-11-27 18:06:01 +01:00
Kasper Timm Hansen
86754a8f7b Use accept header instead of mangling request path.
Instead of appending a format to the request, it's much better
to just pass a more appropriate accept header. Rails will figure
out the format from that instead.

This allows devs to use `:as` on routes that don't have a format.

Introduce an `IdentityEncoder` to avoid `if request_encoder`,
essentially a better version of the purpose of the `WWWFormEncoder`.
One that makes conceptual sense on GET requests too.

Fixes #27144.
2016-11-23 22:02:19 +01:00
Kasper Timm Hansen
333670ceb9 Let TestResponse assign a parser.
Previously we'd only assign a response parser when a request came through
Action Dispatch integration tests. This made calls to `parsed_body` when a TestResponse
was manually instantiated — though own doing or perhaps from a framework — unintentionally
blow up because no parser was set at that time.

The response can lookup a parser entirely through its own ivars. Extract request encoder to
its own file and assume that a viable content type is present at TestResponse instantiation.

Since the default response parser is a no-op, making `parsed_body` equal to `body`, no
exceptions will be thrown.
2016-07-10 22:02:12 +02:00