1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
//go:build go1.7
// +build go1.7
package lexmodelsv2
import (
"context"
"net/http"
"net/http/httptest"
"strings"
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/awstesting/unit"
)
func TestClientContentType(t *testing.T) {
sess := unit.Session.Copy()
server := httptest.NewServer(http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
contentType := r.Header.Get("Content-Type")
if e, a := contentType, "application/x-amz-json-1.1"; !strings.EqualFold(e, a) {
t.Errorf("expect %v content-type, got %v", e, a)
}
},
))
defer server.Close()
client := New(sess, &aws.Config{Endpoint: &server.URL})
_, err := client.ListBotsWithContext(context.Background(),
&ListBotsInput{},
func(r *request.Request) {
},
)
if err != nil {
t.Fatalf("expect no error, got %v", err)
}
}
|