mirror of https://github.com/stretchr/testify.git
docs: Fix deprecation formatting for http
parent
7df1a82a31
commit
056e9e6bfa
|
@ -1,2 +1,2 @@
|
||||||
// Package http DEPRECATED USE net/http/httptest
|
// Deprecated: Use net/http/httptest instead.
|
||||||
package http
|
package http
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestResponseWriter DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead.
|
// Deprecated: Use https://pkg.go.dev/net/http/httptest instead.
|
||||||
type TestResponseWriter struct {
|
type TestResponseWriter struct {
|
||||||
|
|
||||||
// StatusCode is the last int written by the call to WriteHeader(int)
|
// StatusCode is the last int written by the call to WriteHeader(int)
|
||||||
|
@ -17,7 +17,7 @@ type TestResponseWriter struct {
|
||||||
header http.Header
|
header http.Header
|
||||||
}
|
}
|
||||||
|
|
||||||
// Header DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead.
|
// Deprecated: Use https://pkg.go.dev/net/http/httptest instead.
|
||||||
func (rw *TestResponseWriter) Header() http.Header {
|
func (rw *TestResponseWriter) Header() http.Header {
|
||||||
|
|
||||||
if rw.header == nil {
|
if rw.header == nil {
|
||||||
|
@ -27,7 +27,7 @@ func (rw *TestResponseWriter) Header() http.Header {
|
||||||
return rw.header
|
return rw.header
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead.
|
// Deprecated: Use https://pkg.go.dev/net/http/httptest instead.
|
||||||
func (rw *TestResponseWriter) Write(bytes []byte) (int, error) {
|
func (rw *TestResponseWriter) Write(bytes []byte) (int, error) {
|
||||||
|
|
||||||
// assume 200 success if no header has been set
|
// assume 200 success if no header has been set
|
||||||
|
@ -43,7 +43,7 @@ func (rw *TestResponseWriter) Write(bytes []byte) (int, error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// WriteHeader DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead.
|
// Deprecated: Use https://pkg.go.dev/net/http/httptest instead.
|
||||||
func (rw *TestResponseWriter) WriteHeader(i int) {
|
func (rw *TestResponseWriter) WriteHeader(i int) {
|
||||||
rw.StatusCode = i
|
rw.StatusCode = i
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,12 @@ import (
|
||||||
"github.com/stretchr/testify/mock"
|
"github.com/stretchr/testify/mock"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TestRoundTripper DEPRECATED USE net/http/httptest
|
// Deprecated: Use https://pkg.go.dev/net/http/httptest instead.
|
||||||
type TestRoundTripper struct {
|
type TestRoundTripper struct {
|
||||||
mock.Mock
|
mock.Mock
|
||||||
}
|
}
|
||||||
|
|
||||||
// RoundTrip DEPRECATED USE net/http/httptest
|
// Deprecated: Use https://pkg.go.dev/net/http/httptest instead.
|
||||||
func (t *TestRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
func (t *TestRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||||
args := t.Called(req)
|
args := t.Called(req)
|
||||||
return args.Get(0).(*http.Response), args.Error(1)
|
return args.Get(0).(*http.Response), args.Error(1)
|
||||||
|
|
Loading…
Reference in New Issue