github.com/aavshr/aws-sdk-go@v1.41.3/service/lexmodelsv2/customizations_test.go (about)

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