github.com/shogo82148/std@v1.22.1-0.20240327122250-4e474527810c/net/http/triv.go (about) 1 // Copyright 2009 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build ignore 6 7 package main 8 9 import ( 10 "github.com/shogo82148/std/net/http" 11 "github.com/shogo82148/std/sync" 12 ) 13 14 func HelloServer(w http.ResponseWriter, req *http.Request) 15 16 // Simple counter server. POSTing to it will set the value. 17 type Counter struct { 18 mu sync.Mutex 19 n int 20 } 21 22 // This makes Counter satisfy the [expvar.Var] interface, so we can export 23 // it directly. 24 func (ctr *Counter) String() string 25 26 func (ctr *Counter) ServeHTTP(w http.ResponseWriter, req *http.Request) 27 28 func FlagServer(w http.ResponseWriter, req *http.Request) 29 30 // simple argument server 31 func ArgServer(w http.ResponseWriter, req *http.Request) 32 33 // a channel (just for the fun of it) 34 type Chan chan int 35 36 func ChanCreate() Chan 37 38 func (ch Chan) ServeHTTP(w http.ResponseWriter, req *http.Request) 39 40 // exec a program, redirecting output. 41 func DateServer(rw http.ResponseWriter, req *http.Request) 42 43 func Logger(w http.ResponseWriter, req *http.Request)