Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Added support for X-CSRF-Token header acceptance. #180

Merged
merged 1 commit into from
Jan 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/fakes3/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def do_OPTIONS(request, response)

response['Access-Control-Allow-Origin'] = '*'
response['Access-Control-Allow-Methods'] = 'PUT, POST, HEAD, GET, OPTIONS'
response['Access-Control-Allow-Headers'] = 'Accept, Content-Type, Authorization, Content-Length, ETag'
response['Access-Control-Allow-Headers'] = 'Accept, Content-Type, Authorization, Content-Length, ETag, X-CSRF-Token'
response['Access-Control-Expose-Headers'] = 'ETag'
end

Expand Down
10 changes: 7 additions & 3 deletions test/post_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@
class PostTest < Test::Unit::TestCase
# Make sure you have a posttest.localhost in your /etc/hosts/
def setup
@url='http://posttest.localhost:10453/'
@url='http://localhost:10453/'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, why'd you remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having the subdomain piece caused the specs to all error out locally.

Copy link

@aefhm aefhm Jan 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is caused by the version bump from 0.2.4 to 1.0.0?

Edit: not the case.

end

def teardown
end

def test_options
res= RestClient.options(@url) { |response|
RestClient.options(@url) do |response|
assert_equal(response.code, 200)
assert_equal(response.headers[:access_control_allow_origin],"*")
}
assert_equal(response.headers[:access_control_allow_methods], "PUT, POST, HEAD, GET, OPTIONS")
assert_equal(response.headers[:access_control_allow_headers], "Accept, Content-Type, Authorization, Content-Length, ETag, X-CSRF-Token")
assert_equal(response.headers[:access_control_expose_headers], "ETag")
end
end

def test_redirect
Expand Down