mirror of
https://github.com/golang/go
synced 2024-11-17 02:14:42 -07:00
net/http: remove unused method needsSniff
This commit is contained in:
parent
64f2829c9c
commit
9441b8f0c5
@ -972,19 +972,6 @@ func matchErr(err error, wantErr any) error {
|
||||
return fmt.Errorf("%v; want %v", err, wantErr)
|
||||
}
|
||||
|
||||
func TestNeedsSniff(t *testing.T) {
|
||||
// needsSniff returns true with an empty response.
|
||||
r := &response{}
|
||||
if got, want := r.needsSniff(), true; got != want {
|
||||
t.Errorf("needsSniff = %t; want %t", got, want)
|
||||
}
|
||||
// needsSniff returns false when Content-Type = nil.
|
||||
r.handlerHeader = Header{"Content-Type": nil}
|
||||
if got, want := r.needsSniff(), false; got != want {
|
||||
t.Errorf("needsSniff empty Content-Type = %t; want %t", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
// A response should only write out single Connection: close header. Tests #19499.
|
||||
func TestResponseWritesOnlySingleConnectionClose(t *testing.T) {
|
||||
const connectionCloseHeader = "Connection: close"
|
||||
|
@ -555,12 +555,6 @@ func (w *response) requestTooLarge() {
|
||||
}
|
||||
}
|
||||
|
||||
// needsSniff reports whether a Content-Type still needs to be sniffed.
|
||||
func (w *response) needsSniff() bool {
|
||||
_, haveType := w.handlerHeader["Content-Type"]
|
||||
return !w.cw.wroteHeader && !haveType && w.written < sniffLen
|
||||
}
|
||||
|
||||
// writerOnly hides an io.Writer value's optional ReadFrom method
|
||||
// from io.Copy.
|
||||
type writerOnly struct {
|
||||
|
Loading…
Reference in New Issue
Block a user