Also ensure to not process empty Location headers

This commit is contained in:
erwanlr
2014-08-15 23:00:42 +02:00
parent cebd808674
commit 5f53297f58
2 changed files with 10 additions and 1 deletions

View File

@@ -22,7 +22,7 @@ class WpUser < WpItem
if response.code == 301 # login in location?
location = response.headers_hash['Location']
return unless location
return if location.nil? || location.empty?
@login = Existable.login_from_author_pattern(location)
@display_name = Existable.display_name_from_body(

View File

@@ -133,6 +133,15 @@ shared_examples 'WpUser::Existable' do
@display_name = nil
end
end
context 'when the location is empty' do
let(:location) { '' }
it 'returns nil' do
@login = nil
@display_name = nil
end
end
end
context 'with a 200' do