func TestInputService8ProtocolTestRecursiveShapesCase6(t *testing.T) { svc := NewInputService8ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService8TestShapeInputShape{ RecursiveStruct: &InputService8TestShapeRecursiveStructType{ RecursiveMap: &map[string]*InputService8TestShapeRecursiveStructType{ "bar": &InputService8TestShapeRecursiveStructType{ NoRecurse: aws.String("bar"), }, "foo": &InputService8TestShapeRecursiveStructType{ NoRecurse: aws.String("foo"), }, }, }, } req, _ := svc.InputService8TestCaseOperation6Request(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":{"RecursiveMap":{"bar":{"NoRecurse":"bar"},"foo":{"NoRecurse":"foo"}}}}`), util.Trim(string(body))) // assert URL assert.Equal(t, "https://test/path", r.URL.String()) // assert headers }
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 }
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")) }
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")) }
func TestInputService7ProtocolTestOmitsNullQueryParamsButSerializesEmptyStringsCase1(t *testing.T) { svc := NewInputService7ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService7TestShapeInputShape{} req, _ := svc.InputService7TestCaseOperation1Request(input) r := req.HTTPRequest // build request restjson.Build(req) assert.NoError(t, req.Error) // assert URL assert.Equal(t, "https://test/path", r.URL.String()) // assert headers }
func TestInputService2ProtocolTestURIParameterOnlyWithLocationNameCase1(t *testing.T) { svc := NewInputService2ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService2TestShapeInputShape{ Foo: aws.String("bar"), } req, _ := svc.InputService2TestCaseOperation1Request(input) r := req.HTTPRequest // build request restjson.Build(req) assert.NoError(t, req.Error) // assert URL assert.Equal(t, "https://test/2014-01-01/jobsByPipeline/bar", r.URL.String()) // assert headers }
func TestInputService9ProtocolTestTimestampValuesCase2(t *testing.T) { svc := NewInputService9ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService9TestShapeInputShape{ TimeArgInHeader: aws.Time(time.Unix(1422172800, 0)), } req, _ := svc.InputService9TestCaseOperation2Request(input) r := req.HTTPRequest // build request restjson.Build(req) assert.NoError(t, req.Error) // assert URL assert.Equal(t, "https://test/path", r.URL.String()) // assert headers assert.Equal(t, "Sun, 25 Jan 2015 08:00:00 GMT", r.Header.Get("x-amz-timearg")) }
func TestInputService3ProtocolTestURIParameterAndQuerystringParamsCase1(t *testing.T) { svc := NewInputService3ProtocolTest(nil) svc.Endpoint = "https://test" input := &InputService3TestShapeInputShape{ Ascending: aws.String("true"), PageToken: aws.String("bar"), PipelineId: aws.String("foo"), } req, _ := svc.InputService3TestCaseOperation1Request(input) r := req.HTTPRequest // build request restjson.Build(req) assert.NoError(t, req.Error) // assert URL assert.Equal(t, "https://test/2014-01-01/jobsByPipeline/foo?Ascending=true&PageToken=bar", r.URL.String()) // assert headers }