Feat: cos policy upload/download in server-side

This commit is contained in:
HFO4
2020-01-25 11:43:13 +08:00
parent c34f211d7e
commit 4abd5b2346
4 changed files with 67 additions and 11 deletions

View File

@@ -79,6 +79,7 @@ func TestDriver_Source(t *testing.T) {
SecretKey: "sk",
BucketName: "test",
Server: "test.com",
IsPrivate: true,
},
}
@@ -138,6 +139,18 @@ func TestDriver_Source(t *testing.T) {
asserts.EqualValues("838860800", query.Get("x-oss-traffic-limit"))
asserts.NotEmpty(query.Get("response-content-disposition"))
}
// 公共空间
{
handler.Policy.IsPrivate = false
res, err := handler.Source(context.Background(), "/123", url.URL{}, 10, false, 0)
asserts.NoError(err)
resURL, err := url.Parse(res)
asserts.NoError(err)
query := resURL.Query()
asserts.Empty(query.Get("Signature"))
asserts.Empty(query.Get("Expires"))
}
}
func TestDriver_Thumb(t *testing.T) {