MCPcopy
hub / github.com/uber-go/zap / decodePutJSON

Function decodePutJSON

http_handler.go:129–140  ·  view source on GitHub ↗
(body io.Reader)

Source from the content-addressed store, hash-verified

127}
128
129func decodePutJSON(body io.Reader) (zapcore.Level, error) {
130 var pld struct {
131 Level *zapcore.Level `json:"level"`
132 }
133 if err := json.NewDecoder(body).Decode(&pld); err != nil {
134 return 0, fmt.Errorf("malformed request body: %v", err)
135 }
136 if pld.Level == nil {
137 return 0, errors.New("must specify logging level")
138 }
139 return *pld.Level, nil
140}

Callers 1

decodePutRequestFunction · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected