Leon4gr45's picture
Upload folder using huggingface_hub (part 9)
fea99b3 verified
Raw
History Blame Contribute Delete
296 Bytes
package commonhttp
import (
"fmt"
"net/http"
"github.com/go-chi/render"
)
func JSONRequestBodyDecoder(r *http.Request, out any) error {
if err := render.DecodeJSON(r.Body, out); err != nil {
return NewHTTPError(http.StatusBadRequest, fmt.Errorf("decode json: %w", err))
}
return nil
}