mirror of
https://github.com/apple/pkl.git
synced 2026-05-28 01:29:15 +02:00
Follow HTTP redirects (#328)
- Change HttpClient to follow all redirects except HTTPS to HTTP. - Run language snippet tests with --no-cache and real PackageServer instead of pre-seeded cache. This increases HTTP test coverage and enables testing of package redirects. - Change PackageServer to return 301 for request paths starting with /HTTP301/ and 307 for request paths starting with /HTTP307/. - Update some outdated test package checksums that apparently weren't verified.
This commit is contained in:
@@ -16,7 +16,7 @@ examples {
|
||||
import("package://localhost:0/birds@0.5.0#/catalog/Ostritch.pkl")
|
||||
}
|
||||
["importing while specifying checksum"] {
|
||||
import("package://localhost:0/birds@0.5.0::sha256:3f19ab9fcee2f44f93a75a09e531db278c6d2cd25206836c8c2c4071cd7d3118#/catalog/Swallow.pkl")
|
||||
import("package://localhost:0/birds@0.5.0::sha256:bfaf5281613d170a740505cc87561041f4e0cad1f0e6938bf94f7609f9a4673d#/catalog/Swallow.pkl")
|
||||
}
|
||||
["reads"] {
|
||||
read("package://localhost:0/birds@0.5.0#/Bird.pkl")
|
||||
|
||||
@@ -20,6 +20,6 @@ examples {
|
||||
import("package://localhost:0/birds@0.5.0#/allFruit.pkl").fruitFiles
|
||||
}
|
||||
["glob import while specifying checksum"] {
|
||||
import*("package://localhost:0/birds@0.5.0::sha256:3f19ab9fcee2f44f93a75a09e531db278c6d2cd25206836c8c2c4071cd7d3118#/catalog/*.pkl")
|
||||
import*("package://localhost:0/birds@0.5.0::sha256:bfaf5281613d170a740505cc87561041f4e0cad1f0e6938bf94f7609f9a4673d#/catalog/*.pkl")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
amends ".../snippetTest.pkl"
|
||||
|
||||
examples {
|
||||
["permanent redirect is followed"] {
|
||||
import("package://localhost:0/HTTP301/birds@0.5.0#/catalog/Swallow.pkl")
|
||||
}
|
||||
|
||||
["temporary redirect is followed"] {
|
||||
import("package://localhost:0/HTTP307/birds@0.5.0#/catalog/Swallow.pkl")
|
||||
}
|
||||
|
||||
["double redirect is followed"] {
|
||||
import("package://localhost:0/HTTP301/HTTP307/birds@0.5.0#/catalog/Swallow.pkl")
|
||||
}
|
||||
}
|
||||
@@ -118,13 +118,13 @@ examples {
|
||||
}
|
||||
["glob import while specifying checksum"] {
|
||||
new {
|
||||
["package://localhost:0/birds@0.5.0::sha256:3f19ab9fcee2f44f93a75a09e531db278c6d2cd25206836c8c2c4071cd7d3118#/catalog/Ostritch.pkl"] {
|
||||
["package://localhost:0/birds@0.5.0::sha256:bfaf5281613d170a740505cc87561041f4e0cad1f0e6938bf94f7609f9a4673d#/catalog/Ostritch.pkl"] {
|
||||
name = "Ostritch"
|
||||
favoriteFruit {
|
||||
name = "Orange"
|
||||
}
|
||||
}
|
||||
["package://localhost:0/birds@0.5.0::sha256:3f19ab9fcee2f44f93a75a09e531db278c6d2cd25206836c8c2c4071cd7d3118#/catalog/Swallow.pkl"] {
|
||||
["package://localhost:0/birds@0.5.0::sha256:bfaf5281613d170a740505cc87561041f4e0cad1f0e6938bf94f7609f9a4673d#/catalog/Swallow.pkl"] {
|
||||
name = "Swallow"
|
||||
favoriteFruit {
|
||||
name = "Apple"
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
examples {
|
||||
["permanent redirect is followed"] {
|
||||
new {
|
||||
name = "Swallow"
|
||||
favoriteFruit {
|
||||
name = "Apple"
|
||||
}
|
||||
}
|
||||
}
|
||||
["temporary redirect is followed"] {
|
||||
new {
|
||||
name = "Swallow"
|
||||
favoriteFruit {
|
||||
name = "Apple"
|
||||
}
|
||||
}
|
||||
}
|
||||
["double redirect is followed"] {
|
||||
new {
|
||||
name = "Swallow"
|
||||
favoriteFruit {
|
||||
name = "Apple"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user