Skip to content

Commit

Permalink
Transform bool/nulls in query param bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
stevelacey committed Dec 16, 2021
1 parent 9f34095 commit e0b22ac
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion worf/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,14 @@ def set_bundle_from_request(self, request):
def set_bundle_from_query_string(self, request):
raw_bundle = self.flatten_bundle(parse_qs(request.META["QUERY_STRING"]))

self.set_bundle(raw_bundle)
strings = dict(true=True, false=False, null=None)

coerced_bundle = {
key: strings.get(str(value).lower(), value)
for key, value in raw_bundle.items()
}

self.set_bundle(coerced_bundle)

def set_bundle_from_request_body(self, request):
raw_bundle = {}
Expand Down

0 comments on commit e0b22ac

Please sign in to comment.