18 lines
275 B
Go
18 lines
275 B
Go
![]() |
package limit
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"net/http"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestHttp(t *testing.T) {
|
||
|
http.HandleFunc("/test", func(w http.ResponseWriter, r *http.Request) {
|
||
|
lw := NewWriterWithLimit(w, 10*KB)
|
||
|
for {
|
||
|
fmt.Fprintf(lw, "x")
|
||
|
}
|
||
|
})
|
||
|
http.ListenAndServe(":62542", nil)
|
||
|
}
|