_test/sample.plugin
raw| 1 | package sample |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "net/http" |
| 6 | ) |
| 7 | |
| 8 | type Sample struct{} |
| 9 | |
| 10 | func (s *Sample) ServeHTTP(w http.ResponseWriter, r *http.Request, next http.HandlerFunc) { |
| 11 | r.Header.Set("X-sample-test", "Hello") |
| 12 | if next != nil { |
| 13 | next(w, r) |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | func Test() { |
| 18 | fmt.Println("Hello from toto.Test()") |
| 19 | } |