Home | History | Annotate | Download | only in http

Lines Matching refs:Counter

31 // Simple counter server. POSTing to it will set the value.
32 type Counter struct {
37 // This makes Counter satisfy the expvar.Var interface, so we can export
39 func (ctr *Counter) String() string {
45 func (ctr *Counter) ServeHTTP(w http.ResponseWriter, req *http.Request) {
59 fmt.Fprint(w, "counter reset\n")
62 fmt.Fprintf(w, "counter = %d\n", ctr.n)
126 // The counter is published as a variable directly.
127 ctr := new(Counter)
128 expvar.Publish("counter", ctr)
129 http.Handle("/counter", ctr)