More aggressive depercation notice in http pkg

pull/266/head
Ernesto Jiménez 2016-01-09 19:15:46 +01:00
parent c6b07fe328
commit 9b5e169170
3 changed files with 7 additions and 8 deletions

View File

@ -1,2 +1,2 @@
// A set of tools to make testing http activity using the Go testing system easier.
// Package http DEPRECATED USE net/http/httptest
package http

View File

@ -4,10 +4,7 @@ import (
"net/http"
)
// TestResponseWriter is a http.ResponseWriter object that keeps track of all activity
// allowing you to make assertions about how it was used.
//
// DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead.
// TestResponseWriter DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead.
type TestResponseWriter struct {
// StatusCode is the last int written by the call to WriteHeader(int)
@ -20,7 +17,7 @@ type TestResponseWriter struct {
header http.Header
}
// Header gets the http.Header describing the headers that were set in this response.
// Header DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead.
func (rw *TestResponseWriter) Header() http.Header {
if rw.header == nil {
@ -30,7 +27,7 @@ func (rw *TestResponseWriter) Header() http.Header {
return rw.header
}
// Write writes the specified bytes to Output.
// Write DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead.
func (rw *TestResponseWriter) Write(bytes []byte) (int, error) {
// assume 200 success if no header has been set
@ -46,7 +43,7 @@ func (rw *TestResponseWriter) Write(bytes []byte) (int, error) {
}
// WriteHeader stores the HTTP status code in the StatusCode.
// WriteHeader DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead.
func (rw *TestResponseWriter) WriteHeader(i int) {
rw.StatusCode = i
}

View File

@ -5,10 +5,12 @@ import (
"net/http"
)
// TestRoundTripper DEPRECATED USE net/http/httptest
type TestRoundTripper struct {
mock.Mock
}
// RoundTrip DEPRECATED USE net/http/httptest
func (t *TestRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
args := t.Called(req)
return args.Get(0).(*http.Response), args.Error(1)