Compare commits
1
Commits
next
..
81b298c6e4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
81b298c6e4 |
@@ -620,7 +620,10 @@ var hardValues = []string{"python3", "powershell", "ls%20-la", ".htaccess"}
|
|||||||
|
|
||||||
// wantRecordedRequestsPass checks that none of the recorded ordinary
|
// wantRecordedRequestsPass checks that none of the recorded ordinary
|
||||||
// requests in the file name in testdata is refused, at the defaults and
|
// requests in the file name in testdata is refused, at the defaults and
|
||||||
// while bodies are read. Each request runs as its own parallel subtest.
|
// while bodies are read. A request with neither a body nor a Content-Type
|
||||||
|
// header is checked only at the defaults: with neither, the set that reads
|
||||||
|
// bodies has nothing more to check. Each request runs as its own parallel
|
||||||
|
// subtest.
|
||||||
func wantRecordedRequestsPass(t *testing.T, name string) {
|
func wantRecordedRequestsPass(t *testing.T, name string) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
@@ -639,6 +642,15 @@ func wantRecordedRequestsPass(t *testing.T, name string) {
|
|||||||
t.Errorf("%s %s refused: %+v", r.method, r.target, got)
|
t.Errorf("%s %s refused: %+v", r.method, r.target, got)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typed := slices.ContainsFunc(recorded.Headers, func(header string) bool {
|
||||||
|
name, _, _ := strings.Cut(header, ":")
|
||||||
|
|
||||||
|
return strings.EqualFold(name, "Content-Type")
|
||||||
|
})
|
||||||
|
if recorded.Body == "" && !typed {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
got, _ = inspectBody(t, bodies, r, recorded.Body)
|
got, _ = inspectBody(t, bodies, r, recorded.Body)
|
||||||
if got.Score >= threshold {
|
if got.Score >= threshold {
|
||||||
t.Errorf("%s %s %.200q refused while bodies are read: %+v",
|
t.Errorf("%s %s %.200q refused while bodies are read: %+v",
|
||||||
|
|||||||
Reference in new issue
Block a user