aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/http/response.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove default argument, and extract internal convenience methodJon Moss2016-08-291-6/+12
|
* Allow `send_file` to declare a charsetJon Moss2016-08-291-4/+5
| | | | | | Removed my patch in favor of @tenderlove's less invasive approach. [Aaron Patterson & Jon Moss]
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-1/+1
|
* modernizes hash syntax in actionpackXavier Noria2016-08-061-1/+1
|
* applies new string literal convention in actionpack/libXavier Noria2016-08-061-11/+11
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Fixes #23964Ryan T. Hosford2016-03-131-9/+24
| | | | | | | | | | | | | | | | | | - Adds #each_chunk to ActionDispatch::Response. it's a method which will be called by ActionDispatch::Response#each. - Make Response#each a proper method instead of delegating to @stream - In Live, instead of overriding #each, override #each_chunk. - `#each` should just spit out @str_body if it's already set - Adds #test_set_header_after_read_body_during_action to prove this fixes #23964 - Adds #test_each_isnt_called_if_str_body_is_written to ensure #each_chunk is not called when @str_body is available - Call `@response.sent!` in AC::TestCase's #perform so a test response acts a bit more like a real response. Makes test that call `#assert_stream_closed` pass again. - Additionally assert `#committed?` in `#assert_stream_closed` - Make test that was calling @response.stream.each pass again by calling @response.each instead.
* add missing requireAaron Patterson2016-02-051-0/+1
|
* Space OddityAkira Matsuda2016-01-141-1/+1
| | | | | Converting nbsp(\u{00A0}) to the normal ASCII space(\u{0020}) [ci skip]
* Commit before freezing the headersMatthew Draper2016-01-121-0/+7
| | | | | This shouldn't generally come up: under a standard flow, we don't start sending until after the commit. But application code always finds a way.
* Only commit the cookie jar if it hasn't been committedeileencodes2015-12-061-1/+1
| | | | | | | We don't want to commit the cookie jar more than once because then we will be attempting to modify a frozen hash. Fixes Railties test failure caused by 492b134.
* Stop violating law of demeter in response cookie_jareileencodes2015-12-061-1/+1
| | | | | | | | | | | This adds a new method to request and response so we don't need to violate the law of demeter. We are changing `Request` and `Response` so that they always have a `cookie_jar` This is a continuation on work to combine integration and controller test code bases in Rails.
* Push `before_sending` to super classeileencodes2015-12-061-0/+2
| | | | | | | | | | | | We want to get rid of the `Live::Response` so we are consolidating methods from `Live::Response` and `Response` by merging them together. This adds an `#empty` method to the request so we don't need to hard-code the empty array each time we call an empty `ActionDispatch::Request`. The work here is a continuation on combining controller and integration test code bases into one.
* Remove dead codeRafael Mendonça França2015-10-281-5/+0
| | | | This is leftover from when `render nothing: true` rendered blank string.
* use methods for accessing the cache control headersAaron Patterson2015-10-061-0/+4
| | | | | Use the methods rack provides so we don't have to worry about the exact header key.
* Use `Mime[:foo]` instead of `Mime::Type[:FOO]` for back compatJeremy Daer2015-10-061-1/+1
| | | | | | | | | | | | | | | | | Rails 4.x and earlier didn't support `Mime::Type[:FOO]`, so libraries that support multiple Rails versions would've had to feature-detect whether to use `Mime::Type[:FOO]` or `Mime::FOO`. `Mime[:foo]` has been around for ages to look up registered MIME types by symbol / extension, though, so libraries and plugins can safely switch to that without breaking backward- or forward-compatibility. Note: `Mime::ALL` isn't a real MIME type and isn't registered for lookup by type or extension, so it's not available as `Mime[:all]`. We use it internally as a wildcard for `respond_to` negotiation. If you use this internal constant, continue to reference it with `Mime::ALL`. Ref. efc6dd550ee49e7e443f9d72785caa0f240def53
* move file sending to the response objectAaron Patterson2015-10-051-1/+39
| | | | | | | Just a slight refactor that delegates file sending to the response object. This gives us the advantage that if a webserver (in the future) provides a response object that knows how to do accelerated file serving, it can implement this method.
* Introduce `Headers#add`. Move `Response#add_header` upstream.Jeremy Daer2015-10-031-21/+1
| | | | | | | * Introduce `ActionDispatch::Http::Headers#add` to add a value to a multivalued header. * Move `Response#add_header` upstream: https://github.com/rack/rack/pull/957 * Match upstream `Response#have_header?` -> `#has_header?` name change.
* Response#add_header for adding to multi-valued headers like VaryJeremy Daer2015-10-011-0/+20
|
* move the Header hash to the super classAaron Patterson2015-09-241-1/+24
| | | | | | | I want to move the header hash to the super request object in order to consolidate behavior. We should be switching out buffering strategies rather than header strategies since things like "mutating headers after send" is an error in both cases (buffering vs streaming).
* mutate headers before committing the responseAaron Patterson2015-09-241-2/+8
| | | | We should not mutate headers after the response has been committed.
* stop applying default headers in ActionDispatch::ResponseAaron Patterson2015-09-231-6/+10
| | | | | | | | | | I'm making this change so that I can construct response objects that *don't* have the default headers applied. For example, I would like to construct a response object from the return value of a controller. If you need to construct a response object with the default headers, then please use the alternate constructor: `ActionDispatch::Response.create`
* stop calling deprecated methodsAaron Patterson2015-09-211-1/+1
| | | | | We should be asking the mime type method for the mime objects rather than via const lookup
* `rack_response` should use the status it's givenAaron Patterson2015-09-141-1/+1
|
* 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.
* remove mime type lookups when parsing the content typeAaron Patterson2015-09-081-5/+5
| | | | | It turns out that the response object never really cares what the mime type object is, so just use the string.
* refactor content type settingAaron Patterson2015-09-081-44/+39
| | | | pull content-type setting to a private method to dry it up.
* make Content-Type header the canonical location for content-type infoAaron Patterson2015-09-081-34/+50
| | | | | Instead of storing content type information in an ivar and a header, lets move to just store the content type info in just the header.
* pull content type parsing in to a methodAaron Patterson2015-09-081-7/+15
| | | | we'll use this method later to lazily parse content type headers.
* remove useless conditionalAaron Patterson2015-08-271-2/+0
| | | | | cookies are always stored as a string in the header hash, so it will not need to be joined.
* implement the API required by the abstract Rack request.Aaron Patterson2015-08-271-16/+8
|
* use the non-hash dependent Rack utils APIAaron Patterson2015-08-271-2/+2
| | | | eventually we will refactor this to not know about header hashes
* remove redefined methodAaron Patterson2015-08-261-3/+0
| | | | | Rack::Response::Helpers implements this method, so we can safely remove it
* provide a request and response to all controllersAaron Patterson2015-08-251-1/+2
| | | | | | | | | | Controllers should always have a request and response when responding. Since we make this The Rule(tm), then controllers don't need to be somewhere in limbo between "asking a response object for a rack response" or "I, myself contain a rack response". This duality leads to conditionals spread through the codebase that we can delete: * https://github.com/rails/rails/blob/85a78d9358aa728298cd020cdc842b55c16f9549/actionpack/lib/action_controller/metal.rb#L221-L223
* Tiny documentation edits [ci skip]Robin Dupret2015-07-281-1/+1
|
* Merge pull request #20590 from vngrs/set_default_charsetRafael Mendonça França2015-07-271-6/+6
|\ | | | | Document, refactor and create test case for ActionDispatch::Response
| * Document, refactor and create test case for ↵Mehmet Emin İNAÇ2015-06-171-6/+6
| | | | | | | | ActionDispatch::Response#charset= method
* | move buffer caching on to the bufferAaron Patterson2015-07-131-3/+11
| |
* | Fix the comment about attr_reader of headers [ci skip]Mehmet Emin İNAÇ2015-06-161-1/+1
|/
* remove `header=` on the response object.Aaron Patterson2015-06-151-9/+10
| | | | | | People should be free to mutate the header object, but not to set a new header object. That header object may be specific to the webserver, and we need to hide it's internals.
* set the default charset in response initializeAaron Patterson2015-06-151-4/+12
| | | | | this way we don't have to mutate the instance (as much) when writing a rack response
* Spelling/typo/grammatical fixes [ci skip]karanarora2015-05-231-1/+1
| | | | | | | | | | spelling fix [ci skip] example to be consistent [ci skip] grammatical fix typo fixes [ci skip]
* Revert work arounds for upstream Ruby 2.2.0 kwargs bugGenadi Samokovarov2015-03-051-3/+1
| | | | | | | | | | | | | | | | | | | The bug caused a segfault and you can find more info about it at: https://bugs.ruby-lang.org/issues/10685. We did a couple of work arounds, but 2.2.1 rolled out and those aren't needed anymore. Here are the reverted commits: - Revert "Work around for upstream Ruby bug #10685", commit 707a433870e9e06af688f85a4aedc64a90791a64. - Revert "Fix segmentation fault in ActionPack tests", commit 22e0a22d5f98e162290d9820891d8191e720ad3b. I'm also bumping the Ruby version check to 2.2.1 to prevent future segfaults.
* Work around for upstream Ruby bug #10685Genadi Samokovarov2015-03-011-1/+3
| | | | | | | | | | | | | | | | | | | | | In f6e293ec54f02f83cdb37502bea117f66f87bcae we avoided a segfault in the tests, however I think we should try to avoid the crash, as it may happen in user code as well. Here is what I distiled the bug down to: ```ruby # Rails case - works on 2.0, 2.1; crashes on 2.2 require 'action_dispatch' ActionDispatch::Response.new(200, "Content-Type" => "text/xml") # General case - works on 2.0, 2.1; crashes on 2.2 def foo(optional = {}, default_argument: nil) end foo('quux' => 'bar') ```
* Fix default headers in test responsesJeremy Kemper2015-02-251-5/+3
| | | | | | | Fixes regression in #18423. Merge default headers for new responses, but don't merge when creating a response from the last session request. hat tip @senny :heart:
* Remove unneeded requiresRafael Mendonça França2015-01-041-1/+0
| | | | These requires were added only to change deprecation message
* Remove deprecated `ActionDispatch::Response#to_ary`Rafael Mendonça França2015-01-041-15/+0
|
* edit pass over all warningsXavier Noria2014-10-281-3/+3
| | | | | | | | | | | | | | | This patch uniformizes warning messages. I used the most common style already present in the code base: * Capitalize the first word. * End the message with a full stop. * "Rails 5" instead of "Rails 5.0". * Backticks for method names and inline code. Also, converted a few long strings into the new heredoc convention.