mozillazg / go-cos

腾讯云对象存储服务 COS(Cloud Object Storage) Go SDK(XML API)
https://godoc.org/github.com/mozillazg/go-cos
MIT License
88 stars 26 forks source link

上传失败 unsupported protocol scheme "” #18

Closed dduo518 closed 5 years ago

dduo518 commented 5 years ago
u,_:=url.Parse("http://xxx-dev-1xxx.cos.ap-xxx.myqcloud.com")
    b := &cos.BaseURL{BucketURL: u}
    client := cos.NewClient(b, &http.Client{
        Transport: &cos.AuthorizationTransport{
            SecretID: "xxx",
            SecretKey: "xxx",
        },
    })
    opt := &cos.ObjectPutOptions{
        ObjectPutHeaderOptions: &cos.ObjectPutHeaderOptions{
            ContentType: fileType,
            ContentLength:len(content),
        },
        ACLHeaderOptions: &cos.ACLHeaderOptions{
            XCosACL: "private",
        },
    }

    name := "test/objectPut.go"
    f := strings.NewReader("test")
    _, err := client.Object.Put(context.Background(), name, f, nil)
    log.Println(err)

上传失败 返回下面错误:

2019/08/25 16:50:57 Put /test%2FobjectPut.go: unsupported protocol scheme "”