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

21 commits

Author SHA1 Message Date
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
Rafael Mendonça França
fe1f4b2ad5
Add more rubocop rules about whitespaces 2016-10-29 01:17:49 -02:00
Michael Grosser
a9aed2ac94
improve error message when include assertions fail
assert [1, 3].includes?(2) fails with unhelpful "Asserting failed" message

assert_includes [1, 3], 2 fails with "Expected [1, 3] to include 2" which makes it easier to debug and more obvious what went wrong
2016-09-16 12:03:37 -07:00
eileencodes
1ec85cf9d8 Missing key should throw KeyError
It should not throw a NameError, but should throw a KeyError.

Fixes #26278
2016-08-26 13:12:33 -04:00
Rafael Mendonça França
55f9b8129a
Add three new rubocop rules
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces

Fix all violations in the repository.
2016-08-16 04:30:11 -03:00
Xavier Noria
35b3de8021 applies new string literal convention in actionpack/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:54:50 +02:00
Jeremy Daer
2356403330 Introduce Headers#add. Move Response#add_header upstream.
* 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.
2015-10-03 21:59:18 -07:00
Aaron Patterson
34fa6658dd pass a request object to the headers object 2015-08-21 11:21:10 -07:00
Aaron Patterson
c6cfcc6124 move header allocation to a helper method
I'm going to change the constructor, so it's easier to do it in one
place.
2015-08-21 11:21:10 -07:00
schneems
ca97ec5099 HTTP::Headers#key? correctly converts
Previously if you were looking for a given key, the header may incorrectly tell you that it did not exist even though it would return a valid value:

```ruby
env     = { "CONTENT_TYPE" => "text/plain" }
headers = ActionDispatch::Http::Headers.new(env)
headers["Content-Type"] 
# => "text/plain"

headers.key?("Content-Type")
# => false
```

This PR fixes that behavior by converting the key before checking for presence
2014-05-07 12:01:34 -05:00
Yves Senn
41a14dcd10 Http::Headers directly modifies the passed environment.
The env hash passed to `Http::Headers#new` must be in env format.
Also be aware that the passed hash is modified directly.

docs and test-cases for setting headers/env in functional tests.

Follow up to #9700.
2013-03-15 10:13:49 +01:00
Yves Senn
a709246d17 Http::Headers respects dotted env vars, symbols, headers with numbers. 2013-03-13 16:41:00 +01:00
Yves Senn
9af59b2468 allow headers and env to be passed in IntegrationTest.
Closes #6513.
2013-03-13 16:41:00 +01:00
Yves Senn
e2a5de2bb2 refactor, Http::Headers stores headers in env notation
Also:
cleanup, use consistent syntax for `Http::Header` and test.
2013-03-13 16:40:47 +01:00
Yves Senn
8945be464f Http::Headers respects headers that are not prefixed with HTTP_ 2013-03-13 16:27:47 +01:00
Aaron Patterson
b2debfb005 add test for fetch with a block 2012-10-18 15:22:58 -07:00
Aaron Patterson
6ea781c9a7 prefer composition over inheritence 2012-10-18 15:20:30 -07:00
Mark Turner
61ba0fe82c Enable ActionDispatch::Http::Headers to support fetch 2012-05-02 11:22:34 -07:00
Joshua Peek
85750f22c9 Move dispatch related tests into test/dispatch 2009-01-28 22:50:46 -06:00