本文整理汇总了Golang中github.com/awslabs/aws-sdk-go/internal/util.Trim函数的典型用法代码示例。如果您正苦于以下问题:Golang Trim函数的具体用法?Golang Trim怎么用?Golang Trim使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Trim函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestInputService9ProtocolTestTimestampValuesCase1
func TestInputService9ProtocolTestTimestampValuesCase1(t *testing.T) {
svc := NewInputService9ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService9TestShapeInputShape{
TimeArg: aws.Time(time.Unix(1422172800, 0)),
}
req, _ := svc.InputService9TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
restjson.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`{"TimeArg":1422172800}`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/path", r.URL.String())
// assert headers
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:25,代码来源:build_test.go
示例2: TestInputService5ProtocolTestSerializeMapTypeCase2
func TestInputService5ProtocolTestSerializeMapTypeCase2(t *testing.T) {
svc := NewInputService5ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService5TestShapeInputShape{
MapArg: &map[string]*string{},
}
req, _ := svc.InputService5TestCaseOperation2Request(input)
r := req.HTTPRequest
// build request
query.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`Action=OperationName&MapArg=&Version=2014-01-01`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/", r.URL.String())
// assert headers
}
开发者ID:ninefive,项目名称:confd,代码行数:25,代码来源:build_test.go
示例3: TestInputService8ProtocolTestRecursiveShapesCase1
func TestInputService8ProtocolTestRecursiveShapesCase1(t *testing.T) {
svc := NewInputService8ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService8TestShapeInputShape{
RecursiveStruct: &InputService8TestShapeRecursiveStructType{
NoRecurse: aws.String("foo"),
},
}
req, _ := svc.InputService8TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
restjson.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`{"RecursiveStruct":{"NoRecurse":"foo"}}`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/path", r.URL.String())
// assert headers
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:27,代码来源:build_test.go
示例4: TestInputService5ProtocolTestRecursiveShapesCase1
func TestInputService5ProtocolTestRecursiveShapesCase1(t *testing.T) {
svc := NewInputService5ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService5TestShapeInputShape{
RecursiveStruct: &InputService5TestShapeRecursiveStructType{
NoRecurse: aws.String("foo"),
},
}
req, _ := svc.InputService5TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
jsonrpc.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`{"RecursiveStruct":{"NoRecurse":"foo"}}`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/", r.URL.String())
// assert headers
assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type"))
assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:29,代码来源:build_test.go
示例5: TestInputService5ProtocolTestURIParameterQuerystringParamsHeadersAndJSONBodyCase1
func TestInputService5ProtocolTestURIParameterQuerystringParamsHeadersAndJSONBodyCase1(t *testing.T) {
svc := NewInputService5ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService5TestShapeInputShape{
Ascending: aws.String("true"),
Checksum: aws.String("12345"),
Config: &InputService5TestShapeStructType{
A: aws.String("one"),
B: aws.String("two"),
},
PageToken: aws.String("bar"),
PipelineId: aws.String("foo"),
}
req, _ := svc.InputService5TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
restjson.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`{"Config":{"A":"one","B":"two"}}`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/2014-01-01/jobsByPipeline/foo?Ascending=true&PageToken=bar", r.URL.String())
// assert headers
assert.Equal(t, "12345", r.Header.Get("x-amz-checksum"))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:33,代码来源:build_test.go
示例6: TestInputService3ProtocolTestBase64EncodedBlobsCase2
func TestInputService3ProtocolTestBase64EncodedBlobsCase2(t *testing.T) {
svc := NewInputService3ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService3TestShapeInputShape{
BlobMap: &map[string][]byte{
"key1": []byte("foo"),
"key2": []byte("bar"),
},
}
req, _ := svc.InputService3TestCaseOperation2Request(input)
r := req.HTTPRequest
// build request
jsonrpc.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`{"BlobMap":{"key1":"Zm9v","key2":"YmFy"}}`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/", r.URL.String())
// assert headers
assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type"))
assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:30,代码来源:build_test.go
示例7: TestInputService4ProtocolTestNestedBlobsCase1
func TestInputService4ProtocolTestNestedBlobsCase1(t *testing.T) {
svc := NewInputService4ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService4TestShapeInputShape{
ListParam: [][]byte{
[]byte("foo"),
[]byte("bar"),
},
}
req, _ := svc.InputService4TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
jsonrpc.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`{"ListParam":["Zm9v","YmFy"]}`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/", r.URL.String())
// assert headers
assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type"))
assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:30,代码来源:build_test.go
示例8: TestInputService6ProtocolTestStreamingPayloadCase1
func TestInputService6ProtocolTestStreamingPayloadCase1(t *testing.T) {
svc := NewInputService6ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService6TestShapeInputShape{
Body: aws.ReadSeekCloser(bytes.NewBufferString("contents")),
Checksum: aws.String("foo"),
VaultName: aws.String("name"),
}
req, _ := svc.InputService6TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
restjson.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`contents`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/2014-01-01/vaults/name/archives", r.URL.String())
// assert headers
assert.Equal(t, "foo", r.Header.Get("x-amz-sha256-tree-hash"))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:28,代码来源:build_test.go
示例9: TestInputService2ProtocolTestTimestampValuesCase1
func TestInputService2ProtocolTestTimestampValuesCase1(t *testing.T) {
svc := NewInputService2ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService2TestShapeInputShape{
TimeArg: aws.Time(time.Unix(1422172800, 0)),
}
req, _ := svc.InputService2TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
jsonrpc.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`{"TimeArg":1422172800}`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/", r.URL.String())
// assert headers
assert.Equal(t, "application/x-amz-json-1.1", r.Header.Get("Content-Type"))
assert.Equal(t, "com.amazonaws.foo.OperationName", r.Header.Get("X-Amz-Target"))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:27,代码来源:build_test.go
示例10: TestInputService6ProtocolTestBase64EncodedBlobsCase1
func TestInputService6ProtocolTestBase64EncodedBlobsCase1(t *testing.T) {
svc := NewInputService6ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService6TestShapeInputShape{
BlobArg: []byte("foo"),
}
req, _ := svc.InputService6TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
query.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`Action=OperationName&BlobArg=Zm9v&Version=2014-01-01`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/", r.URL.String())
// assert headers
}
开发者ID:Dahlgren,项目名称:platform,代码行数:25,代码来源:build_test.go
示例11: TestInputService3ProtocolTestListTypesCase1
func TestInputService3ProtocolTestListTypesCase1(t *testing.T) {
svc := NewInputService3ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService3TestShapeInputShape{
ListArg: []*string{
aws.String("foo"),
aws.String("bar"),
aws.String("baz"),
},
}
req, _ := svc.InputService3TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
query.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`Action=OperationName&ListArg.member.1=foo&ListArg.member.2=bar&ListArg.member.3=baz&Version=2014-01-01`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/", r.URL.String())
// assert headers
}
开发者ID:Dahlgren,项目名称:platform,代码行数:29,代码来源:build_test.go
示例12: TestInputService8ProtocolTestRecursiveShapesCase2
func TestInputService8ProtocolTestRecursiveShapesCase2(t *testing.T) {
svc := NewInputService8ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService8TestShapeInputShape{
RecursiveStruct: &InputService8TestShapeInputService8TestShapeRecursiveStructType{
RecursiveStruct: &InputService8TestShapeInputService8TestShapeRecursiveStructType{
NoRecurse: aws.String("foo"),
},
},
}
req, _ := svc.InputService8TestCaseOperation2Request(input)
r := req.HTTPRequest
// build request
query.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`Action=OperationName&RecursiveStruct.RecursiveStruct.NoRecurse=foo&Version=2014-01-01`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/", r.URL.String())
// assert headers
}
开发者ID:Dahlgren,项目名称:platform,代码行数:29,代码来源:build_test.go
示例13: TestInputService7ProtocolTestTimestampValuesCase1
func TestInputService7ProtocolTestTimestampValuesCase1(t *testing.T) {
svc := NewInputService7ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService7TestShapeInputShape{
TimeArg: aws.Time(time.Unix(1422172800, 0)),
}
req, _ := svc.InputService7TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
query.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`Action=OperationName&TimeArg=2015-01-25T08%3A00%3A00Z&Version=2014-01-01`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/", r.URL.String())
// assert headers
}
开发者ID:Dahlgren,项目名称:platform,代码行数:25,代码来源:build_test.go
示例14: TestInputService4ProtocolTestFlattenedListCase1
func TestInputService4ProtocolTestFlattenedListCase1(t *testing.T) {
svc := NewInputService4ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService4TestShapeInputShape{
ListArg: []*string{
aws.String("a"),
aws.String("b"),
aws.String("c"),
},
ScalarArg: aws.String("foo"),
}
req, _ := svc.InputService4TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
query.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`Action=OperationName&ListArg.1=a&ListArg.2=b&ListArg.3=c&ScalarArg=foo&Version=2014-01-01`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/", r.URL.String())
// assert headers
}
开发者ID:Dahlgren,项目名称:platform,代码行数:30,代码来源:build_test.go
示例15: TestInputService2ProtocolTestNestedStructureMembersCase1
func TestInputService2ProtocolTestNestedStructureMembersCase1(t *testing.T) {
svc := NewInputService2ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService2TestShapeInputShape{
StructArg: &InputService2TestShapeStructType{
ScalarArg: aws.String("foo"),
},
}
req, _ := svc.InputService2TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
query.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`Action=OperationName&StructArg.ScalarArg=foo&Version=2014-01-01`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/", r.URL.String())
// assert headers
}
开发者ID:Dahlgren,项目名称:platform,代码行数:27,代码来源:build_test.go
示例16: TestInputService1ProtocolTestScalarMembersCase1
func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) {
svc := NewInputService1ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService1TestShapeInputShape{
Bar: aws.String("val2"),
Foo: aws.String("val1"),
}
req, _ := svc.InputService1TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
query.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`Action=OperationName&Bar=val2&Foo=val1&Version=2014-01-01`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/", r.URL.String())
// assert headers
}
开发者ID:Dahlgren,项目名称:platform,代码行数:26,代码来源:build_test.go
示例17: TestInputService5ProtocolTestListWithLocationNameAppliedToMemberCase1
func TestInputService5ProtocolTestListWithLocationNameAppliedToMemberCase1(t *testing.T) {
svc := NewInputService5ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService5TestShapeInputShape{
ListArg: []*string{
aws.String("a"),
aws.String("b"),
aws.String("c"),
},
}
req, _ := svc.InputService5TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
ec2query.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`Action=OperationName&ListMemberName.1=a&ListMemberName.2=b&ListMemberName.3=c&Version=2014-01-01`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/", r.URL.String())
// assert headers
}
开发者ID:maximilien,项目名称:go_service_broker,代码行数:29,代码来源:build_test.go
示例18: TestInputService6ProtocolTestSerializeMapTypeWithLocationNameCase1
func TestInputService6ProtocolTestSerializeMapTypeWithLocationNameCase1(t *testing.T) {
svc := NewInputService6ProtocolTest(nil)
svc.Endpoint = "https://test"
input := &InputService6TestShapeInputShape{
MapArg: &map[string]*string{
"key1": aws.String("val1"),
"key2": aws.String("val2"),
},
}
req, _ := svc.InputService6TestCaseOperation1Request(input)
r := req.HTTPRequest
// build request
query.Build(req)
assert.NoError(t, req.Error)
// assert body
assert.NotNil(t, r.Body)
body, _ := ioutil.ReadAll(r.Body)
assert.Equal(t, util.Trim(`Action=OperationName&MapArg.entry.1.TheKey=key1&MapArg.entry.1.TheValue=val1&MapArg.entry.2.TheKey=key2&MapArg.entry.2.TheValue=val2&Version=2014-01-01`), util.Trim(string(body)))
// assert URL
assert.Equal(t, "https://test/", r.URL.String())
// assert headers
}
开发者ID:ninefive,项目名称:confd,代码行数:28,代码来源:build_test.go
示例19: NewInputService1ProtocolTest
"io"
"io/ioutil"
"net/http"
"net/url"
"testing"
"time"
)
var _ bytes.Buffer // always import bytes
var _ http.Request
var _ json.Marshaler
var _ time.Time
var _ xmlutil.XMLNode
var _ xml.Attr
var _ = ioutil.Discard
var _ = util.Trim("")
var _ = url.Values{}
var _ = io.EOF
// InputService1ProtocolTest is a client for InputService1ProtocolTest.
type InputService1ProtocolTest struct {
*aws.Service
}
// New returns a new InputService1ProtocolTest client.
func NewInputService1ProtocolTest(config *aws.Config) *InputService1ProtocolTest {
if config == nil {
config = &aws.Config{}
}
service := &aws.Service{
开发者ID:navneet-flipkart,项目名称:confd,代码行数:31,代码来源:build_test.go
注:本文中的github.com/awslabs/aws-sdk-go/internal/util.Trim函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论