Skip to content

Commit

Permalink
unit test for http request with empty request body
Browse files Browse the repository at this point in the history
  • Loading branch information
semihbkgr committed Nov 11, 2023
1 parent 019f932 commit d0d0869
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions modules/http-helper/http_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,21 @@ func TestErrorWithRetry(t *testing.T) {
}
}

func TestEmptyRequestBodyWithRetryWithOptions(t *testing.T) {
t.Parallel()
ts := getTestServerForFunction(bodyCopyHandler)
defer ts.Close()

options := HttpDoOptions{
Method: "GET",
Url: ts.URL,
Body: nil,
}

response := HTTPDoWithRetryWithOptions(t, options, 200, 0, time.Second)
require.Equal(t, "", response)
}

func bodyCopyHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
body, _ := io.ReadAll(r.Body)
Expand Down

0 comments on commit d0d0869

Please sign in to comment.