Let rack convert to the internal names instead of using them
directly and bypassing some of the internals.
post "/api/0.6/changeset/#{changeset.id}/upload",
:params => diff,
:headers => bearer_authorization_header(user).merge(
post "/api/0.6/changeset/#{changeset.id}/upload",
:params => diff,
:headers => bearer_authorization_header(user).merge(
- "HTTP_CONTENT_TYPE" => "application/xml"
+ "Content-Type" => "application/xml"
)
assert_response :success,
"can't upload an uncompressed diff to changeset: #{@response.body}"
)
assert_response :success,
"can't upload an uncompressed diff to changeset: #{@response.body}"
post "/api/0.6/changeset/#{changeset.id}/upload",
:params => gzip_content(diff),
:headers => bearer_authorization_header(user).merge(
post "/api/0.6/changeset/#{changeset.id}/upload",
:params => gzip_content(diff),
:headers => bearer_authorization_header(user).merge(
- "HTTP_CONTENT_ENCODING" => "gzip",
- "HTTP_CONTENT_TYPE" => "application/xml"
+ "Content-Encoding" => "gzip",
+ "Content-Type" => "application/xml"
)
assert_response :success,
"can't upload a gzip compressed diff to changeset: #{@response.body}"
)
assert_response :success,
"can't upload a gzip compressed diff to changeset: #{@response.body}"
post "/api/0.6/changeset/#{changeset.id}/upload",
:params => deflate_content(diff),
:headers => bearer_authorization_header(user).merge(
post "/api/0.6/changeset/#{changeset.id}/upload",
:params => deflate_content(diff),
:headers => bearer_authorization_header(user).merge(
- "HTTP_CONTENT_ENCODING" => "deflate",
- "HTTP_CONTENT_TYPE" => "application/xml"
+ "Content-Encoding" => "deflate",
+ "Content-Type" => "application/xml"
)
assert_response :success,
"can't upload a deflate compressed diff to changeset: #{@response.body}"
)
assert_response :success,
"can't upload a deflate compressed diff to changeset: #{@response.body}"
post "/api/0.6/changeset/#{changeset.id}/upload",
:params => "",
:headers => bearer_authorization_header(user).merge(
post "/api/0.6/changeset/#{changeset.id}/upload",
:params => "",
:headers => bearer_authorization_header(user).merge(
- "HTTP_CONTENT_ENCODING" => "unknown",
- "HTTP_CONTENT_TYPE" => "application/xml"
+ "Content-Encoding" => "unknown",
+ "Content-Type" => "application/xml"
)
assert_response :unsupported_media_type
end
)
assert_response :unsupported_media_type
end
class CORSTest < ActionDispatch::IntegrationTest
def test_api_routes_allow_cross_origin_requests
process :options, "/api/capabilities", :headers => {
class CORSTest < ActionDispatch::IntegrationTest
def test_api_routes_allow_cross_origin_requests
process :options, "/api/capabilities", :headers => {
- "HTTP_ORIGIN" => "http://www.example.com",
- "HTTP_ACCESS_CONTROL_REQUEST_METHOD" => "GET"
+ "Origin" => "http://www.example.com",
+ "Access-Control-Request-Method" => "GET"
}
assert_response :success
}
assert_response :success
def test_non_api_routes_dont_allow_cross_origin_requests
process :options, "/", :headers => {
def test_non_api_routes_dont_allow_cross_origin_requests
process :options, "/", :headers => {
- "HTTP_ORIGIN" => "http://www.example.com",
- "HTTP_ACCESS_CONTROL_REQUEST_METHOD" => "GET"
+ "Origin" => "http://www.example.com",
+ "Access-Control-Request-Method" => "GET"
}
assert_response :success
}
assert_response :success
assert_empty User.find(user.id).languages
assert_select "html[lang=?]", "en"
assert_empty User.find(user.id).languages
assert_select "html[lang=?]", "en"
- get "/diary/new", :headers => { "HTTP_ACCEPT_LANGUAGE" => "fr, en" }
+ get "/diary/new", :headers => { "Accept-Language" => "fr, en" }
assert_equal %w[fr en], User.find(user.id).languages
assert_select "html[lang=?]", "fr"
end
assert_equal %w[fr en], User.find(user.id).languages
assert_select "html[lang=?]", "fr"
end