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
be4f2d63
Commit
be4f2d63
authored
Apr 13, 2014
by
Boris Bügling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always try GET if HEAD fails when validating URLs.
Fixes problem in CocoaPods/Specs#10341
parent
dc49ae52
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
validator.rb
lib/cocoapods/validator.rb
+1
-1
validator_spec.rb
spec/unit/validator_spec.rb
+9
-0
No files found.
lib/cocoapods/validator.rb
View file @
be4f2d63
...
...
@@ -236,7 +236,7 @@ module Pod
loop
do
resp
=
::
REST
.
head
(
url
)
if
resp
.
status_code
==
405
if
resp
.
status_code
>=
400
resp
=
::
REST
.
get
(
url
)
end
...
...
spec/unit/validator_spec.rb
View file @
be4f2d63
...
...
@@ -98,6 +98,7 @@ module Pod
it
"checks if the homepage is valid"
do
WebMock
::
API
.
stub_request
(
:head
,
/not-found/
).
to_return
(
:status
=>
404
)
WebMock
::
API
.
stub_request
(
:get
,
/not-found/
).
to_return
(
:status
=>
404
)
Specification
.
any_instance
.
stubs
(
:homepage
).
returns
(
'http://banana-corp.local/not-found/'
)
@sut
.
validate
@sut
.
results
.
map
(
&
:to_s
).
first
.
should
.
match
/The URL (.*) is not reachable/
...
...
@@ -127,6 +128,14 @@ module Pod
@sut
.
results
.
length
.
should
.
equal
0
end
it
"does not fail if the homepage errors on HEAD"
do
WebMock
::
API
.
stub_request
(
:head
,
/page/
).
to_return
(
:status
=>
500
)
WebMock
::
API
.
stub_request
(
:get
,
/page/
).
to_return
(
:status
=>
200
)
Specification
.
any_instance
.
stubs
(
:homepage
).
returns
(
'http://banana-corp.local/page/'
)
@sut
.
validate
@sut
.
results
.
length
.
should
.
equal
0
end
it
"does not follow redirects infinitely"
do
WebMock
::
API
.
stub_request
(
:head
,
/redirect/
).
to_return
(
:status
=>
301
,
...
...
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