refactor: go modernisation fixes
This commit is contained in:
1 parent
8e4923991d
commit
b2da85ead1
14 files changed
+41
-53
No files matched your search
@@ -54,8 +54,7 @@ func (s *Server) handleWorkRequest(w http.ResponseWriter, r *http.Request) {
|
||||
decoder := json.NewDecoder(r.Body)
|
||||
decoder.DisallowUnknownFields()
|
||||
if err := decoder.Decode(&request); err != nil {
|
||||
var tooLarge *http.MaxBytesError
|
||||
if errors.As(err, &tooLarge) {
|
||||
if _, ok := errors.AsType[*http.MaxBytesError](err); ok {
|
||||
http.Error(w, "work request body too large", http.StatusRequestEntityTooLarge)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user