aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
Commit message (Collapse)AuthorAgeFilesLines
...
* | Fix a typo: Mime::Types should be Mime::Type [ci skip]Juanito Fatas2015-09-221-1/+1
| |
* | Merge pull request #21703 from ronakjangir47/redirect_error_messagesJeremy Daer2015-09-211-2/+4
|\ \ | | | | | | Added assertion for error messages for redirection to nil and params
| * | Added assertion for error messages for redirection to nil and params Ronak Jangir2015-09-211-2/+4
| | | | | | | | | As both `redirect_to_nil` and `redirect_to_params` are raising same `ActionController::ActionControllerError` so it’s good to assert error messages as well
* | | drop array allocations on Mime::Type#=~Aaron Patterson2015-09-211-3/+1
| | | | | | | | | | | | | | | Synonyms are always a list of strings, and we have access to the internal string representation, so we can avoid allocating new arrays.
* | | remove another `blank?` callAaron Patterson2015-09-211-1/+1
| | |
* | | remove html_types setAaron Patterson2015-09-212-7/+3
| | | | | | | | | | | | Now that `all` has it's own object, we don't need the html_types Set.
* | | introduce an `All` mime typeAaron Patterson2015-09-213-3/+11
| | | | | | | | | | | | | | | This class gives us the `all?` predicate method that returns true without hitting method missing
* | | remove `blank?` calls on `==`Aaron Patterson2015-09-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Since Mime::Type implements `method_missing`, and `blank?` triggers it's positive branch: https://github.com/rails/rails/blob/f9dda1567ea8d5b27bd9d66ac5a8b43dc67a6b7e/actionpack/lib/action_dispatch/http/mime_type.rb#L342 We should stop calling `blank?`.
* | | change inheritance to compositionAaron Patterson2015-09-212-16/+27
| | | | | | | | | | | | | | | | | | Changes `Mimes` to compose a set rather than inherit from array. With this change we don't need to define as many methods, so ISEQ memory is saved. Also it is clear which methods break the set cache.
* | | update changelog for mime changesAaron Patterson2015-09-211-0/+13
| | |
* | | swap upcase and to_symAaron Patterson2015-09-211-1/+1
| | |
* | | stop calling deprecated methodsAaron Patterson2015-09-2122-93/+93
| | | | | | | | | | | | | | | We should be asking the mime type method for the mime objects rather than via const lookup
* | | deprecate accessing mime types via constantsAaron Patterson2015-09-214-42/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't want to manage a list of constants on `Mime::`. Managing constants is strange because it will break method caches, not to mention looking up by a constant could cause troubles. For example suppose there is a top level constant `HTML`, but nobody registers the HTML mime type and someone accesses `Mime::HTML`. Instead of getting an error about how the mime type doesn't exist, instead you'll get the top level constant. So, instead of directly accessing the constants, change this: Mime::HTML To this: Mime::Type[:HTML]
* | | cache the new type object on the stackAaron Patterson2015-09-211-2/+2
|/ / | | | | | | Now we don't have to look it up with a `const_get`.
* | Update routing.rbHarry V. Kiselev2015-09-201-0/+1
| | | | | | forgotten end of the block
* | TypppoAkira Matsuda2015-09-211-3/+3
| |
* | Added test for `send_file_headers` called with nil content typeRonak Jangir2015-09-191-1/+12
| |
* | mostly remove the ParamsParser middlewareAaron Patterson2015-09-181-1/+0
| | | | | | | | | | This can still be added to the middleware stack, but is really not necessary. I'll follow up with a commit that deprecates the constant
* | remove outdated commentAaron Patterson2015-09-181-4/+0
| | | | | | | | | | all parameter parsing is done on the request object now, so we don't need to worry about at ParamParser middleware
* | all parameter parsing is done through the request object now.Aaron Patterson2015-09-181-1/+1
| |
* | let the request object handle parsing XML postsAaron Patterson2015-09-181-2/+9
| | | | | | | | | | The test request object will handle parsing XML posts now, so we don't need to eagerly parse them in the test harness
* | remove setting request parameters for JSON requestsAaron Patterson2015-09-181-2/+0
| | | | | | | | | | The request object will automatically parse these in the `parse_formatted_parameters` method, so we don't have to worry about it.
* | remove the request parameter from `parse_formatted_parameters`Aaron Patterson2015-09-182-6/+6
| | | | | | | | | | This is an instance method on the request object now so we don't need it anymore
* | do not instantiate a param parser middlewareAaron Patterson2015-09-182-14/+14
| | | | | | | | | | | | we don't actually need a param parser middleware instance since the request object will take care of parsing parameters for us. For now, we'll just configure the parameter parsers on the request in this class.
* | push the parameter parsers on to the classAaron Patterson2015-09-183-37/+37
| | | | | | | | | | | | | | | | The middleware stack is a singleton in the application (one instance is shared for the entire application) which means that there was only one opportunity to set the parameter parsers. Since there is only one set of parameter parsers in an app, lets just configure them on the request class (since that is where they are used).
* | stop eagerly parsing parametersAaron Patterson2015-09-181-2/+0
| | | | | | | | | | Parameters will not be parsed until they are specifically requested via the `request_parameters` method.
* | only wrap the strategy with exception handlingAaron Patterson2015-09-181-9/+10
| | | | | | | | | | | | we need to be more specific about exception handling when dealing with the parse strategies. The calls to `return yield` can also raise an exception, but we don't want to handle that in *this* code.
* | pull `normalize_encode_params` upAaron Patterson2015-09-182-4/+3
| | | | | | | | | | `normalize_encode_params` is common to all parser code paths, so we can pull that up and always apply it before assigning the request parameters
* | remove the `default` parameter from the parser methodAaron Patterson2015-09-181-8/+5
| | | | | | | | | | since there is only one "default" strategy now, we can just use the block parameter for that.
* | move parameter parsing to the request objectAaron Patterson2015-09-182-22/+37
|/ | | | | All parameter parsing should be on the request object because the request object is the object that we ask for parameters.
* File encoding is defaulted to utf-8 in Ruby >= 2.1Akira Matsuda2015-09-184-7/+0
|
* Use rack.session_options instead of directly change envJuanito Fatas2015-09-161-1/+1
|
* fewer direct env manipulationsAaron Patterson2015-09-152-2/+2
| | | | this commit removes some direct access to `env`.
* allocate request objects with the env hash, set routes on the requestAaron Patterson2015-09-152-9/+6
| | | | | This commit is to abstract the code away from the env hash. It no longer needs to have the routes key hard coded.
* only "normalize" onceAaron Patterson2015-09-141-1/+1
|
* create a new renderer instance on calls to `for`Aaron Patterson2015-09-142-55/+49
| | | | | | | | | | | | This changes the renderer class to store the controller and defaults as an instance variable rather than allocating a new class. You can create a new renderer with an new env by calling `Renderer#new` or use new defaults by calling `Renderer#with_defaults` and saving the return value somewhere. Also I want to keep the `env` private since I would like to change the keys in the future. This commit only translates particular keys that the user requested.
* eagerly allocate the renderer objectAaron Patterson2015-09-143-9/+10
| | | | | this means the reader doesn't need to lock, but does have the added cost of a new object created for every controller
* initialize `@renderer` to avoid ivar warningsAaron Patterson2015-09-141-1/+8
|
* add a lock when allocating the rendererAaron Patterson2015-09-141-1/+5
| | | | | The controller class is shared among threads, so we need to lock when allocating the Renderer.
* `rack_response` should use the status it's givenAaron Patterson2015-09-141-1/+1
|
* Fix HSTS default expire in ActionDispatch::SSL docs.Pedro Nascimento2015-09-141-1/+2
|
* Merge pull request #21584 from claudiob/remove-hawd-docClaudio B.2015-09-101-3/+2
|\ | | | | Remove wrong doc line about AC::Parameters
| * Remove wrong doc line about AC::Parametersclaudiob2015-09-101-3/+2
| | | | | | | | | | AC::Parameters does not inherit from HashWithIndifferentAccess since #20868 by @sikachu
* | Update documentation to reflect Rack::Session::Abstract changeseileencodes2015-09-091-1/+1
| | | | | | | | | | `Rack::Session::Abstract::ID` is now deprecated and `Rack::Session::Abstract::Persisted` should be used instead.
* | Handle Content-Types that are not :json, :xml, or :url_encoded_formeileencodes2015-09-092-2/+30
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In c546a2b this was changed to mimic how the browser behaves in a real situation but left out types that were registered. When this was changed it didn't take `text/plain` or `text/html` content types into account. This is a problem if you're manipulating the `Content-Type` headers in your controller tests, and expect a certain result. The reason I changed this to use `to_sym` is because if the `Content-Type` is not registered then the symbol will not exist. If it's one of the special types we handle that specifically (:json, :xml, or :url_encoded_form). If it's any registered type we handle it by setting the `path_parameters` and then the `request_parameters`. If the `to_sym` returns nil an error will be thrown. If the controller test sets a `Content-Type` on the request that `Content-Type` should remain in the header and pass along the filename. For example: If a test sets a content type on a post ``` @request.headers['CONTENT_TYPE'] = 'text/plain' post :create, params: { name: 'foo.txt' } ``` Then `foo.txt` should be in the `request_parameters` and params related to the path should be in the `path_parameters` and the `Content-Type` header should match the one set in the `@request`. When c546a2b was committed `text/plain` and `text/html` types were throwing a "Unknown Content-Type" error which is misleading and incorrect. Note: this does not affect how this is handled in the browser, just how the controller tests handle setting `Content-Type`.
* ensure that mutating headers will impact the content_type methodAaron Patterson2015-09-081-0/+5
|
* mime_type will always return a stringAaron Patterson2015-09-081-2/+1
|
* remove `parse_content_type` parameterAaron Patterson2015-09-081-6/+7
| | | | | This method is specifically about the content type so lets remove the parameter.
* avoid allocations when there is no content type setAaron Patterson2015-09-081-1/+2
| | | | | create a singleton content type that just has nils, so that we don't have to allocate a content type object all the time.
* handle implicit rendering correctlyAaron Patterson2015-09-081-3/+4
| | | | | | | If someone sets just a charset, but depends on the implicit type from rendering, this will store a strange content type header that looks like this: `; charset=blah`. This is so that when the content type header is parsed again, it will return nil for the actual type.