github.com/aavshr/aws-sdk-go@v1.41.3/aws/request/request_1_7_test.go (about)

     1  //go:build !go1.8
     2  // +build !go1.8
     3  
     4  package request
     5  
     6  import (
     7  	"net/http"
     8  	"strings"
     9  	"testing"
    10  )
    11  
    12  func TestResetBody_WithEmptyBody(t *testing.T) {
    13  	r := Request{
    14  		HTTPRequest: &http.Request{},
    15  	}
    16  
    17  	reader := strings.NewReader("")
    18  	r.Body = reader
    19  
    20  	r.ResetBody()
    21  
    22  	if a, e := r.HTTPRequest.Body, (noBody{}); a != e {
    23  		t.Errorf("expected request body to be set to reader, got %#v", r.HTTPRequest.Body)
    24  	}
    25  }