From 1966db1679f46c46bfbed1de105ca2e043475362 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Thu, 5 Sep 2019 15:18:41 +0100 Subject: [PATCH] Stops parameters with single values being treated as lists --- pappyproxy/proxy.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pappyproxy/proxy.py b/pappyproxy/proxy.py index 97afb5e..579b54e 100644 --- a/pappyproxy/proxy.py +++ b/pappyproxy/proxy.py @@ -218,12 +218,14 @@ class URL: def set_param(self, key, val): params = self.parameters() - params[key] = [val] + params[key] = val self.query = urlencode(params) def add_param(self, key, val): params = self.parameters() if key in params: + if not isinstance( params[key], list ): + params[key] = [params[key]] params[key].append(val) else: params[key] = [val] @@ -356,12 +358,14 @@ class HTTPRequest: def set_param(self, key, val): params = self.parameters() - params[key] = [val] + params[key] = val self.body = urlencode(params) def add_param(self, key, val): params = self.parameters() if key in params: + if not isinstance( params[key], list ): + params[key] = [params[key]] params[key].append(val) else: params[key] = [val]