Skip to content

Commit

Permalink
test: add TestRequestDigestAuthWithBody
Browse files Browse the repository at this point in the history
  • Loading branch information
icepie committed Oct 12, 2023
1 parent 284c90a commit d3026f9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,25 @@ func TestRequestDigestAuthFail(t *testing.T) {
logResponse(t, resp)
}

func TestRequestDigestAuthWithBody(t *testing.T) {
conf := defaultDigestServerConf()
ts := createDigestServer(t, nil)
defer ts.Close()

resp, err := dclr().
SetDigestAuth(conf.username, conf.password).
SetResult(&AuthSuccess{}).
SetHeader(hdrContentTypeKey, "application/json").
SetBody(map[string]interface{}{"zip_code": "00000", "city": "Los Angeles"}).
Post(ts.URL + conf.uri)

assertError(t, err)
assertEqual(t, http.StatusOK, resp.StatusCode())

t.Logf("Result Success: %q", resp.Result().(*AuthSuccess))
logResponse(t, resp)
}

func TestFormData(t *testing.T) {
ts := createFormPostServer(t)
defer ts.Close()
Expand Down

0 comments on commit d3026f9

Please sign in to comment.