mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[rubygems/rubygems] Add charset to Webauthn response content-type
442a3e8f37
This commit is contained in:
parent
db80e947a3
commit
17b50cdb68
3 changed files with 6 additions and 6 deletions
|
@ -81,7 +81,7 @@ module Gem::GemcutterUtilities
|
||||||
|
|
||||||
def add_body
|
def add_body
|
||||||
return unless body
|
return unless body
|
||||||
@http_response["content-type"] = "text/plain"
|
@http_response["content-type"] = "text/plain; charset=utf-8"
|
||||||
@http_response["content-length"] = body.bytesize
|
@http_response["content-length"] = body.bytesize
|
||||||
@http_response.instance_variable_set(:@body, body)
|
@http_response.instance_variable_set(:@body, body)
|
||||||
end
|
end
|
||||||
|
|
|
@ -55,7 +55,7 @@ class WebauthnListenerTest < Gem::TestCase
|
||||||
response = Gem::MockBrowser.get URI("http://localhost:#{@port}?code=xyz")
|
response = Gem::MockBrowser.get URI("http://localhost:#{@port}?code=xyz")
|
||||||
|
|
||||||
assert response.is_a? Net::HTTPOK
|
assert response.is_a? Net::HTTPOK
|
||||||
assert_equal "text/plain", response["Content-Type"]
|
assert_equal "text/plain; charset=utf-8", response["Content-Type"]
|
||||||
assert_equal "7", response["Content-Length"]
|
assert_equal "7", response["Content-Length"]
|
||||||
assert_equal Gem.host, response["access-control-allow-origin"]
|
assert_equal Gem.host, response["access-control-allow-origin"]
|
||||||
assert_equal "POST", response["access-control-allow-methods"]
|
assert_equal "POST", response["access-control-allow-methods"]
|
||||||
|
@ -96,7 +96,7 @@ class WebauthnListenerTest < Gem::TestCase
|
||||||
response = Gem::MockBrowser.get URI("http://localhost:#{@port}")
|
response = Gem::MockBrowser.get URI("http://localhost:#{@port}")
|
||||||
|
|
||||||
assert response.is_a? Net::HTTPBadRequest
|
assert response.is_a? Net::HTTPBadRequest
|
||||||
assert_equal "text/plain", response["Content-Type"]
|
assert_equal "text/plain; charset=utf-8", response["Content-Type"]
|
||||||
assert_equal "22", response["Content-Length"]
|
assert_equal "22", response["Content-Length"]
|
||||||
assert_equal "close", response["Connection"]
|
assert_equal "close", response["Connection"]
|
||||||
assert_equal "missing code parameter", response.body
|
assert_equal "missing code parameter", response.body
|
||||||
|
@ -110,7 +110,7 @@ class WebauthnListenerTest < Gem::TestCase
|
||||||
response = Gem::MockBrowser.get URI("http://localhost:#{@port}?param=xyz")
|
response = Gem::MockBrowser.get URI("http://localhost:#{@port}?param=xyz")
|
||||||
|
|
||||||
assert response.is_a? Net::HTTPBadRequest
|
assert response.is_a? Net::HTTPBadRequest
|
||||||
assert_equal "text/plain", response["Content-Type"]
|
assert_equal "text/plain; charset=utf-8", response["Content-Type"]
|
||||||
assert_equal "22", response["Content-Length"]
|
assert_equal "22", response["Content-Length"]
|
||||||
assert_equal "close", response["Connection"]
|
assert_equal "close", response["Connection"]
|
||||||
assert_equal "missing code parameter", response.body
|
assert_equal "missing code parameter", response.body
|
||||||
|
|
|
@ -18,7 +18,7 @@ class WebauthnListenerResponseTest < Gem::TestCase
|
||||||
access-control-allow-origin: rubygems.example\r
|
access-control-allow-origin: rubygems.example\r
|
||||||
access-control-allow-methods: POST\r
|
access-control-allow-methods: POST\r
|
||||||
access-control-allow-headers: Content-Type, Authorization, x-csrf-token\r
|
access-control-allow-headers: Content-Type, Authorization, x-csrf-token\r
|
||||||
content-type: text/plain\r
|
content-type: text/plain; charset=utf-8\r
|
||||||
content-length: 7\r
|
content-length: 7\r
|
||||||
\r
|
\r
|
||||||
success
|
success
|
||||||
|
@ -82,7 +82,7 @@ class WebauthnListenerResponseTest < Gem::TestCase
|
||||||
access-control-allow-origin: rubygems.example\r
|
access-control-allow-origin: rubygems.example\r
|
||||||
access-control-allow-methods: POST\r
|
access-control-allow-methods: POST\r
|
||||||
access-control-allow-headers: Content-Type, Authorization, x-csrf-token\r
|
access-control-allow-headers: Content-Type, Authorization, x-csrf-token\r
|
||||||
content-type: text/plain\r
|
content-type: text/plain; charset=utf-8\r
|
||||||
content-length: 22\r
|
content-length: 22\r
|
||||||
\r
|
\r
|
||||||
missing code parameter
|
missing code parameter
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue