阿里云oss

This commit is contained in:
lzh
2025-07-16 14:55:59 +08:00
parent 0c7ec61e65
commit 1e2d00edaf
2 changed files with 33 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
package oss_tool
import (
"github.com/aliyun/alibabacloud-oss-go-sdk-v2/oss"
"os"
"testing"
)
@@ -36,6 +37,22 @@ func TestALiYunOSSClient_GetSignUrl(t *testing.T) {
t.Log(sign)
}
func TestALiYunOSSClient_GetSignUrlByPutObjectRequest(t *testing.T) {
err := client.NewAliYunOSS()
if err != nil {
t.Error(err)
}
req := &oss.PutObjectRequest{}
req.Bucket = oss.Ptr("")
req.Key = oss.Ptr("test/upload/bizhi2.jpg")
req.ContentType = oss.Ptr("application/octet-stream")
sign, err := client.GetSignUrlByPutObjectRequest(req, 0)
if err != nil {
t.Error(err)
}
t.Log(sign)
}
func TestALiYunOSSClient_PutForLocalFile(t *testing.T) {
err := client.NewAliYunOSS()
if err != nil {