@@ -92,9 +92,13 @@ def dispatch_request(self, *args, **kwargs):
9292 if meth is None and request .method == "HEAD" :
9393 meth = getattr (self , "get" , None )
9494
95- # Marhal response if a response schema is defines
95+ # Inject request arguments if an args schema is defined
96+ if request .method in ("POST" , "PUT" , "PATCH" ) and self .get_args ():
97+ meth = use_args (self .get_args ())(meth )
98+
99+ # Marhal response if a response schema is defined
96100 if (
97- request .method in ("GET" , "PUT" , "POST" , "PATCH" , "DELETE" )
101+ request .method in ("GET" , "PUT" , "POST" , "PATCH" )
98102 and self .get_schema ()
99103 ):
100104 meth = marshal_with (self .get_schema ())(meth )
@@ -190,22 +194,8 @@ def get_args(cls):
190194 return cls .schema
191195
192196 def dispatch_request (self , * args , ** kwargs ):
193- meth = getattr (self , request .method .lower (), None )
194-
195- # If the request method is HEAD and we don't have a handler for it
196- # retry with GET.
197- if meth is None and request .method == "HEAD" :
198- meth = getattr (self , "get" , None )
199-
200- # Flask should ensure this is assersion never fails
201- assert meth is not None , f"Unimplemented method { request .method !r} "
202-
203- # Inject request arguments if an args schema is defined
204- if request .method in ("POST" , "PUT" , "PATCH" ) and self .get_args ():
205- meth = use_args (self .get_args ())(meth )
206-
207197 # Generate basic response
208- resp = self . represent_response ( meth ( * args , ** kwargs ) )
198+ resp = View . dispatch_request ( self , * args , ** kwargs )
209199
210200 # Emit property event
211201 if request .method in ("POST" , "PUT" , "DELETE" , "PATCH" ):
0 commit comments