Add Endpoint for some compatible instance and fix time format (#3)

* Add Endpoint for some compatible instance.

* Fix: InvalidExpiration
* Fix: RequestTimeTooSkewed

Compatible s3: https://developer.qiniu.com/kodo/manual/4088/s3-access-domainname

* - clean code

* Fix: InvalidExpiration
This commit is contained in:
Liut
2019-12-11 07:53:05 +00:00
committed by Rohan Verma
parent 3d5b071ef7
commit 9a5e82a977
6 changed files with 72 additions and 37 deletions
+4
View File
@@ -39,6 +39,7 @@ func TestS3_GeneratePresignedURL_Personal(t *testing.T) {
dontwant := ""
if got := s.GeneratePresignedURL(PresignedInput{
Bucket: os.Getenv("AWS_S3_BUCKET"),
Endpoint: os.Getenv("AWS_S3_ENDPOINT"),
ObjectKey: "test1.txt",
Method: "GET",
Timestamp: NowTime(),
@@ -59,6 +60,7 @@ func TestS3_GeneratePresignedURL_ExtraHeader(t *testing.T) {
dontwant := ""
if got := s.GeneratePresignedURL(PresignedInput{
Bucket: os.Getenv("AWS_S3_BUCKET"),
Endpoint: os.Getenv("AWS_S3_ENDPOINT"),
ObjectKey: "test2.txt",
Method: "GET",
Timestamp: NowTime(),
@@ -82,6 +84,7 @@ func TestS3_GeneratePresignedURL_PUT(t *testing.T) {
dontwant := ""
if got := s.GeneratePresignedURL(PresignedInput{
Bucket: os.Getenv("AWS_S3_BUCKET"),
Endpoint: os.Getenv("AWS_S3_ENDPOINT"),
ObjectKey: "test2.txt",
Method: "PUT",
Timestamp: NowTime(),
@@ -105,6 +108,7 @@ func BenchmarkS3_GeneratePresigned(b *testing.B) {
for n := 0; n < b.N; n++ {
s.GeneratePresignedURL(PresignedInput{
Bucket: os.Getenv("AWS_S3_BUCKET"),
Endpoint: os.Getenv("AWS_S3_ENDPOINT"),
ObjectKey: "test.txt",
Method: "GET",
Timestamp: NowTime(),