Skip to content

Commit

Permalink
Handle true false in query params
Browse files Browse the repository at this point in the history
FusionAuth/fusionauth-python-client#10 is the issue.

when we are handed a True object, we need to serialize it to the string 'true'.

In staticly typed languages we use a converter. I didn't think python had one, so just brute forced it with a function call.
  • Loading branch information
mooreds committed May 2, 2022
1 parent b456dd2 commit 79abb01
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/client/python.client.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class FusionAuthClient:
[#if param.type == "urlSegment"]
.url_segment(${global.convertValue(param, "python")}) \
[#elseif param.type == "urlParameter"]
.url_parameter('${param.parameterName}', ${global.convertValue(param, "python")}) \
.url_parameter('${param.parameterName}', self.convert_true_false(${global.convertValue(param, "python")})) \
[#elseif param.type == "body"]
.body_handler(JSONBodyHandler(${camel_to_underscores(param.name)})) \
[/#if]
Expand All @@ -85,6 +85,13 @@ class FusionAuthClient:
.go()

[/#list]
def convert_true_false(self,val):
if val == True:
return 'true'
if val == False:
return 'false'
return val

def start(self):
return self.start_anonymous().authorization(self.api_key)

Expand Down

0 comments on commit 79abb01

Please sign in to comment.