Skip to content

Commit 4641e66

Browse files
committed
Fixed switched arg_methods and marshal_methods
1 parent 881ee3f commit 4641e66

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/labthings/server/view/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ class View(MethodView):
4646
title: None
4747

4848
responses: dict = {}
49+
arg_methods = ("POST", "PUT", "PATCH")
50+
marshal_methods = ("GET", "PUT", "POST", "PATCH")
4951

5052
def __init__(self, *args, **kwargs):
5153
MethodView.__init__(self, *args, **kwargs)
@@ -93,12 +95,18 @@ def dispatch_request(self, *args, **kwargs):
9395
meth = getattr(self, "get", None)
9496

9597
# Inject request arguments if an args schema is defined
96-
if request.method in ("POST", "PUT", "PATCH") and self.get_args():
98+
if request.method in self.arg_methods and self.get_args():
9799
meth = use_args(self.get_args())(meth)
98100

99101
# Marhal response if a response schema is defined
102+
print("")
103+
print(meth)
104+
print(request.method)
105+
print(self.marshal_methods)
106+
print(request.method in self.marshal_methods)
107+
print(self.get_schema())
100108
if (
101-
request.method in ("GET", "PUT", "POST", "PATCH")
109+
request.method in self.marshal_methods
102110
and self.get_schema()
103111
):
104112
meth = marshal_with(self.get_schema())(meth)

0 commit comments

Comments
 (0)