mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Handle 301 better.
This commit is contained in:
parent
79e7f7b397
commit
4919b19196
2 changed files with 8 additions and 2 deletions
|
@ -66,7 +66,7 @@ class Kurl(val hostInfo: HostConfig) {
|
||||||
if (connection is HttpURLConnection) {
|
if (connection is HttpURLConnection) {
|
||||||
val responseCode = (connection as HttpURLConnection).responseCode
|
val responseCode = (connection as HttpURLConnection).responseCode
|
||||||
checkResponseCode(responseCode)
|
checkResponseCode(responseCode)
|
||||||
responseCode == 200
|
responseCode == 200 || responseCode == 301
|
||||||
} else if (url.startsWith(FileDependency.PREFIX_FILE)) {
|
} else if (url.startsWith(FileDependency.PREFIX_FILE)) {
|
||||||
val fileName = url.substring(FileDependency.PREFIX_FILE.length)
|
val fileName = url.substring(FileDependency.PREFIX_FILE.length)
|
||||||
File(fileName).exists()
|
File(fileName).exists()
|
||||||
|
|
|
@ -17,7 +17,8 @@ import kotlin.properties.Delegates
|
||||||
/**
|
/**
|
||||||
* TODO: test snapshots https://repository.jboss.org/nexus/content/repositories/root_repository//commons-lang/commons-lang/2.7-SNAPSHOT/commons-lang-2.7-SNAPSHOT.jar
|
* TODO: test snapshots https://repository.jboss.org/nexus/content/repositories/root_repository//commons-lang/commons-lang/2.7-SNAPSHOT/commons-lang-2.7-SNAPSHOT.jar
|
||||||
*/
|
*/
|
||||||
public class DownloadTest @Inject constructor(
|
@Test
|
||||||
|
class DownloadTest @Inject constructor(
|
||||||
val depFactory: DepFactory,
|
val depFactory: DepFactory,
|
||||||
val localRepo: LocalRepo,
|
val localRepo: LocalRepo,
|
||||||
val executors: KobaltExecutors) : KobaltTest() {
|
val executors: KobaltExecutors) : KobaltTest() {
|
||||||
|
@ -134,5 +135,10 @@ public class DownloadTest @Inject constructor(
|
||||||
Assert.assertTrue(Kurl(HostConfig(url)).exists, "Should exist: $url")
|
Assert.assertTrue(Kurl(HostConfig(url)).exists, "Should exist: $url")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun jitpackTest() {
|
||||||
|
val id = "http://jitpack.io/com/github/JakeWharton/RxBinding/rxbinding-kotlin/542cd7e8a4/rxbinding-kotlin-542cd7e8a4.aar"
|
||||||
|
Assert.assertTrue(Kurl(HostConfig(id)).exists)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue