context: implement a spy response writer to check if anything is written
This commit is contained in:
@ -3,6 +3,7 @@ package context
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
@ -12,7 +13,11 @@ type Store interface {
|
||||
|
||||
func Server(store Store) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
data, _ := store.Fetch(r.Context())
|
||||
data, err := store.Fetch(r.Context())
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
fmt.Fprint(w, data)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user