(req *http.Request)
| 107 | } |
| 108 | |
| 109 | func readBody(req *http.Request) ([]byte, error) { |
| 110 | bodyCopy := &bytes.Buffer{} |
| 111 | r := io.TeeReader(req.Body, bodyCopy) |
| 112 | req.Body = io.NopCloser(bodyCopy) |
| 113 | return io.ReadAll(r) |
| 114 | } |
| 115 | |
| 116 | func decodeJSONBody(req *http.Request, dest interface{}) error { |
| 117 | b, err := readBody(req) |