mirror of
https://github.com/kataras/iris.git
synced 2025-12-17 18:07:01 +00:00
(#1554) Add support for all common compressions (write and read)
- Remove the context.Context interface and export the *context, the iris.Context now points to the pointer\nSupport compression and rate limiting in the FileServer\nBit of code organisation Former-commit-id: ad1c61bf968059510c6be9e7f2cceec7da70ba17
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
package context
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// Recorder the middleware to enable response writer recording ( ResponseWriter -> ResponseRecorder)
|
||||
var Recorder = func(ctx Context) {
|
||||
var Recorder = func(ctx *Context) {
|
||||
ctx.Record()
|
||||
ctx.Next()
|
||||
}
|
||||
@@ -90,20 +89,6 @@ func (w *ResponseRecorder) Write(contents []byte) (int, error) {
|
||||
return len(contents), nil
|
||||
}
|
||||
|
||||
// Writef formats according to a format specifier and writes to the response.
|
||||
//
|
||||
// Returns the number of bytes written and any write error encountered.
|
||||
func (w *ResponseRecorder) Writef(format string, a ...interface{}) (n int, err error) {
|
||||
return fmt.Fprintf(w, format, a...)
|
||||
}
|
||||
|
||||
// WriteString writes a simple string to the response.
|
||||
//
|
||||
// Returns the number of bytes written and any write error encountered
|
||||
func (w *ResponseRecorder) WriteString(s string) (n int, err error) {
|
||||
return w.Write([]byte(s))
|
||||
}
|
||||
|
||||
// SetBody overrides the body and sets it to a slice of bytes value.
|
||||
func (w *ResponseRecorder) SetBody(b []byte) {
|
||||
w.chunks = b
|
||||
|
||||
Reference in New Issue
Block a user