@@ -92,9 +92,13 @@ def dispatch_request(self, *args, **kwargs):
92
92
if meth is None and request .method == "HEAD" :
93
93
meth = getattr (self , "get" , None )
94
94
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
96
100
if (
97
- request .method in ("GET" , "PUT" , "POST" , "PATCH" , "DELETE" )
101
+ request .method in ("GET" , "PUT" , "POST" , "PATCH" )
98
102
and self .get_schema ()
99
103
):
100
104
meth = marshal_with (self .get_schema ())(meth )
@@ -190,22 +194,8 @@ def get_args(cls):
190
194
return cls .schema
191
195
192
196
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
-
207
197
# Generate basic response
208
- resp = self . represent_response ( meth ( * args , ** kwargs ) )
198
+ resp = View . dispatch_request ( self , * args , ** kwargs )
209
199
210
200
# Emit property event
211
201
if request .method in ("POST" , "PUT" , "DELETE" , "PATCH" ):
0 commit comments