Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions tos/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import (
"strings"
"testing"

"github.com/stretchr/testify/require"
"golang.org/x/text/encoding/simplifiedchinese"
"golang.org/x/text/transform"

"github.com/stretchr/testify/require"
)

func TestIsValidBucketName(t *testing.T) {
Expand Down
13 changes: 7 additions & 6 deletions tos/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"encoding/hex"
"encoding/json"
"fmt"
"github.com/volcengine/ve-tos-golang-sdk/v2/tos/enum"
"net"
"net/http"
"net/url"
Expand All @@ -17,6 +16,8 @@ import (
"strings"
"sync"
"time"

"github.com/volcengine/ve-tos-golang-sdk/v2/tos/enum"
)

const (
Expand Down Expand Up @@ -598,7 +599,7 @@ func (cli *ClientV2) PreSignedURL(input *PreSignedURLInput) (*PreSignedURLOutput
return output, nil
}

func (cli *ClientV2) PreSignedPostSignature(ctx context.Context, input *PreSingedPostSignatureInput) (*PreSingedPostSignatureOutput, error) {
func (cli *ClientV2) PreSignedPostSignature(ctx context.Context, input *PreSignedPostSignatureInput) (*PreSignedPostSignatureOutput, error) {
algorithm := signPrefix
postPolicy := make(map[string]interface{})
cred := cli.credentials.Credential()
Expand Down Expand Up @@ -650,7 +651,7 @@ func (cli *ClientV2) PreSignedPostSignature(ctx context.Context, input *PreSinge
Credential: &cred,
})
policy := base64.StdEncoding.EncodeToString(originPolicy)
return &PreSingedPostSignatureOutput{
return &PreSignedPostSignatureOutput{
OriginPolicy: string(originPolicy),
Policy: policy,
Algorithm: signPrefix,
Expand Down Expand Up @@ -756,7 +757,7 @@ func (cli *ClientV2) PutFetchTaskV2(ctx context.Context, input *PutFetchTaskInpu
return &output, nil
}

func (cli *ClientV2) PreSignedPolicyURL(ctx context.Context, input *PreSingedPolicyURLInput) (*PreSingedPolicyURLOutput, error) {
func (cli *ClientV2) PreSignedPolicyURL(ctx context.Context, input *PreSignedPolicyURLInput) (*PreSignedPolicyURLOutput, error) {

if err := isValidBucketName(input.Bucket, input.IsCustomDomain); err != nil {
return nil, err
Expand All @@ -771,7 +772,7 @@ func (cli *ClientV2) PreSignedPolicyURL(ctx context.Context, input *PreSingedPol
}

if cli.credentials == nil {
return &PreSingedPolicyURLOutput{
return &PreSignedPolicyURLOutput{
bucket: input.Bucket,
scheme: resScheme,
host: resHost,
Expand Down Expand Up @@ -866,7 +867,7 @@ func (cli *ClientV2) PreSignedPolicyURL(ctx context.Context, input *PreSingedPol
rawQuery := query.Encode()
// set scheme and host

return &PreSingedPolicyURLOutput{
return &PreSignedPolicyURLOutput{
bucket: input.Bucket,
SignatureQuery: rawQuery,
scheme: resScheme,
Expand Down
3 changes: 2 additions & 1 deletion tos/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"context"
"errors"
"fmt"
"github.com/volcengine/ve-tos-golang-sdk/v2/tos/enum"
"hash"
"io"
"io/ioutil"
Expand All @@ -14,6 +13,8 @@ import (
"path/filepath"
"strconv"
"time"

"github.com/volcengine/ve-tos-golang-sdk/v2/tos/enum"
)

type Bucket struct {
Expand Down
8 changes: 5 additions & 3 deletions tos/tests/anonymous_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/stretchr/testify/require"
"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
"net/http"
"strings"
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
)

func TestAnonymous(t *testing.T) {
Expand Down Expand Up @@ -132,7 +134,7 @@ func TestAnonymous(t *testing.T) {
require.Nil(t, err)
require.Equal(t, resp.StatusCode, 200)
operatorEq := "eq"
policyUrl, err := client.PreSignedPolicyURL(context.Background(), &tos.PreSingedPolicyURLInput{
policyUrl, err := client.PreSignedPolicyURL(context.Background(), &tos.PreSignedPolicyURLInput{
Bucket: bucket,
Expires: 3600,
Conditions: []tos.PolicySignatureCondition{{
Expand Down
4 changes: 3 additions & 1 deletion tos/tests/bucket_tag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package tests

import (
"context"
"testing"

"github.com/stretchr/testify/require"

"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
"testing"
)

func TestBktTagging(t *testing.T) {
Expand Down
6 changes: 4 additions & 2 deletions tos/tests/callback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ package tests
import (
"context"
"encoding/base64"
"github.com/stretchr/testify/require"
"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
"net/http"
"os"
"strings"
"testing"

"github.com/stretchr/testify/require"

"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
)

type callback struct {
Expand Down
1 change: 1 addition & 0 deletions tos/tests/connect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"time"

"github.com/stretchr/testify/require"

"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
)

Expand Down
1 change: 1 addition & 0 deletions tos/tests/cors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"testing"

"github.com/stretchr/testify/require"

"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
"github.com/volcengine/ve-tos-golang-sdk/v2/tos/codes"
)
Expand Down
8 changes: 5 additions & 3 deletions tos/tests/custom_domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package tests

import (
"context"
"github.com/stretchr/testify/require"
"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
"github.com/volcengine/ve-tos-golang-sdk/v2/tos/enum"
"net/http"
"strings"
"testing"

"github.com/stretchr/testify/require"

"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
"github.com/volcengine/ve-tos-golang-sdk/v2/tos/enum"
)

func TestBucketCustomDomain(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions tos/tests/dns_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"time"

"github.com/stretchr/testify/require"

"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
)

Expand Down
4 changes: 3 additions & 1 deletion tos/tests/encryption_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package tests

import (
"context"
"testing"

"github.com/stretchr/testify/require"

"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
"testing"
)

func TestEncryption(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions tos/tests/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/sirupsen/logrus"
"github.com/stretchr/testify/require"

"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
)

Expand Down
1 change: 1 addition & 0 deletions tos/tests/fetch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"time"

"github.com/stretchr/testify/require"

"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
"github.com/volcengine/ve-tos-golang-sdk/v2/tos/enum"
)
Expand Down
8 changes: 5 additions & 3 deletions tos/tests/hns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ package tests
import (
"context"
"encoding/json"
"github.com/stretchr/testify/require"
"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
"github.com/volcengine/ve-tos-golang-sdk/v2/tos/enum"
"io/ioutil"
"net/http"
"strings"
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
"github.com/volcengine/ve-tos-golang-sdk/v2/tos/enum"
)

type Trash struct {
Expand Down
1 change: 1 addition & 0 deletions tos/tests/lifecycle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

"github.com/stretchr/testify/require"

"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
"github.com/volcengine/ve-tos-golang-sdk/v2/tos/enum"
)
Expand Down
6 changes: 4 additions & 2 deletions tos/tests/list_object_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package tests
import (
"context"
"fmt"
"github.com/stretchr/testify/require"
"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
"net/http"
"strings"
"testing"

"github.com/stretchr/testify/require"

"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
)

func TestListObjWithMeta(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions tos/tests/mirror_back_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"testing"

"github.com/stretchr/testify/require"

"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
"github.com/volcengine/ve-tos-golang-sdk/v2/tos/enum"
)
Expand Down
1 change: 1 addition & 0 deletions tos/tests/notification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"testing"

"github.com/stretchr/testify/require"

"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
)

Expand Down
2 changes: 1 addition & 1 deletion tos/tests/object_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"encoding/hex"
"errors"
"fmt"
"github.com/sirupsen/logrus"
"io"
"io/ioutil"
"math/rand"
Expand All @@ -21,6 +20,7 @@ import (
"testing"
"time"

"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down
8 changes: 5 additions & 3 deletions tos/tests/parse_output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package tests

import (
"context"
"github.com/stretchr/testify/require"
"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
"net/http"
"strings"
"testing"

"github.com/stretchr/testify/require"

"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
)

func TestParseOutput(t *testing.T) {
Expand Down Expand Up @@ -49,7 +51,7 @@ func TestParseOutput(t *testing.T) {
// build policy url
operatorSw := "starts-with"
operatorEq := "eq"
output, err := cli.PreSignedPolicyURL(ctx, &tos.PreSingedPolicyURLInput{
output, err := cli.PreSignedPolicyURL(ctx, &tos.PreSignedPolicyURLInput{
Bucket: bucket,
Expires: 1000,
Conditions: []tos.PolicySignatureCondition{{
Expand Down
1 change: 1 addition & 0 deletions tos/tests/policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"testing"

"github.com/stretchr/testify/require"

"github.com/volcengine/ve-tos-golang-sdk/v2/tos"
)

Expand Down
Loading