Skip to content

Commit

Permalink
More aggressive depercation notice in http pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
ernesto-jimenez committed Jan 9, 2016
1 parent c6b07fe commit 9b5e169
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion http/doc.go
Original file line number Diff line number Diff line change
@@ -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
11 changes: 4 additions & 7 deletions http/test_response_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand All @@ -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
Expand All @@ -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
}
2 changes: 2 additions & 0 deletions http/test_round_tripper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9b5e169

Please sign in to comment.