MCPcopy Index your code
hub / github.com/dreamsofcode-io/nethttp / FindByID

Method FindByID

monster/handler.go:17–25  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

15}
16
17func (h *Handler) FindByID(w http.ResponseWriter, r *http.Request) {
18 log.Println("handling READ request - Method:", r.Method)
19 monster, exists := loadMonsters()[r.PathValue("id")]
20 if !exists {
21 w.WriteHeader(http.StatusNotFound)
22 return
23 }
24 json.NewEncoder(w).Encode(monster)
25}
26
27func (h *Handler) UpdateByID(w http.ResponseWriter, r *http.Request) {
28 log.Println("Handling UPDATE request - Method:", r.Method)

Callers

nothing calls this directly

Calls 2

loadMonstersFunction · 0.85
WriteHeaderMethod · 0.80

Tested by

no test coverage detected