Skip to content

Commit

Permalink
chore: ResponseWriter rename responseWriterBase
Browse files Browse the repository at this point in the history
  • Loading branch information
appleboy committed Jun 21, 2018
1 parent 28a6d2b commit 8ed5d8b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 43 deletions.
23 changes: 23 additions & 0 deletions response_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,29 @@ const (
defaultStatus = 200
)

type responseWriterBase interface {
http.ResponseWriter
http.Hijacker
http.Flusher
http.CloseNotifier

// Returns the HTTP response status code of the current request.
Status() int

// Returns the number of bytes already written into the response http body.
// See Written()
Size() int

// Writes the string into the response body.
WriteString(string) (int, error)

// Returns true if the response body was already written.
Written() bool

// Forces to write the http header (status code + headers).
WriteHeaderNow()
}

type responseWriter struct {
http.ResponseWriter
size int
Expand Down
23 changes: 1 addition & 22 deletions response_writer_1.7.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,7 @@

package gin

import "net/http"

// ResponseWriter ...
type ResponseWriter interface {
http.ResponseWriter
http.Hijacker
http.Flusher
http.CloseNotifier

// Returns the HTTP response status code of the current request.
Status() int

// Returns the number of bytes already written into the response http body.
// See Written()
Size() int

// Writes the string into the response body.
WriteString(string) (int, error)

// Returns true if the response body was already written.
Written() bool

// Forces to write the http header (status code + headers).
WriteHeaderNow()
responseWriterBase
}
22 changes: 1 addition & 21 deletions response_writer_1.8.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,7 @@ import (

// ResponseWriter ...
type ResponseWriter interface {
http.ResponseWriter
http.Hijacker
http.Flusher
http.CloseNotifier

// Returns the HTTP response status code of the current request.
Status() int

// Returns the number of bytes already written into the response http body.
// See Written()
Size() int

// Writes the string into the response body.
WriteString(string) (int, error)

// Returns true if the response body was already written.
Written() bool

// Forces to write the http header (status code + headers).
WriteHeaderNow()

responseWriterBase
// get the http.Pusher for server push
Pusher() http.Pusher
}
Expand Down

0 comments on commit 8ed5d8b

Please sign in to comment.