Some tests

This commit is contained in:
binwiederhier 2022-12-31 16:08:49 -05:00
parent 0bb3c84b9e
commit 598d0bdda3
4 changed files with 61 additions and 22 deletions

View file

@ -124,8 +124,8 @@ func extractIPAddress(r *http.Request, behindProxy bool) netip.Addr {
}
func readJSONWithLimit[T any](r io.ReadCloser, limit int) (*T, error) {
obj, err := util.ReadJSONWithLimit[T](r, limit)
if err == util.ErrInvalidJSON {
obj, err := util.UnmarshalJSONWithLimit[T](r, limit)
if err == util.ErrUnmarshalJSON {
return nil, errHTTPBadRequestJSONInvalid
} else if err == util.ErrTooLargeJSON {
return nil, errHTTPEntityTooLargeJSONBody