Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
616f89b4
Commit
616f89b4
authored
Apr 18, 2014
by
Boris Bügling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support relative redirects when validating URLs.
This fixes CocoaPods/Core#104
parent
cbf504ca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
1 deletion
+20
-1
validator.rb
lib/cocoapods/validator.rb
+8
-1
validator_spec.rb
spec/unit/validator_spec.rb
+12
-0
No files found.
lib/cocoapods/validator.rb
View file @
616f89b4
...
...
@@ -241,7 +241,14 @@ module Pod
end
if
[
301
,
302
,
303
,
307
,
308
].
include?
resp
.
status_code
url
=
resp
.
headers
[
'location'
].
first
location
=
resp
.
headers
[
'location'
].
first
if
location
=~
/:\/\//
url
=
location
else
url
=
url
+
location
end
redirects
+=
1
else
break
...
...
spec/unit/validator_spec.rb
View file @
616f89b4
...
...
@@ -145,6 +145,18 @@ module Pod
@sut
.
validate
@sut
.
results
.
map
(
&
:to_s
).
first
.
should
.
match
/The URL \(.*\) is not reachable/
end
it
"supports relative redirects"
do
WebMock
::
API
.
stub_request
(
:head
,
/redirect$/
).
to_return
(
:status
=>
302
,
:headers
=>
{
'Location'
=>
'/'
})
WebMock
::
API
.
stub_request
(
:head
,
/redirect\/$/
).
to_return
(
:status
=>
200
)
Specification
.
any_instance
.
stubs
(
:homepage
).
returns
(
'http://banana-corp.local/redirect'
)
@sut
.
validate
@sut
.
results
.
length
.
should
.
equal
0
end
end
describe
"Screenshot validation"
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment