Skip to content

Commit

Permalink
add setter for get values
Browse files Browse the repository at this point in the history
  • Loading branch information
xmendez committed Dec 28, 2018
1 parent 97c950b commit 9e3b8cb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/wfuzz/fuzzobjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,14 @@ def __init__(self, req):
def get(self):
return OrderedDict([(x.name, x.value) for x in self._req.getGETVars()])

@get.setter
def get(self, values):
if isinstance(values, dict):
for key, value in values.items():
self._req.setVariableGET(key, value)
else:
raise FuzzExceptBadAPI("GET Parameters must be specified as a dictionary")

@property
def post(self):
return OrderedDict([(x.name, x.value) for x in self._req.getPOSTVars()])
Expand Down
7 changes: 7 additions & 0 deletions tests/test_reqresp.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ def test_setpostdata(self):
self.assertEqual(fr.method, "POST")
self.assertEqual(fr.params.post, {'a': '1'})

def test_setgetdata(self):
fr = FuzzRequest()

fr.url = "http://www.wfuzz.org/"
fr.params.get = {'a': '1'}
self.assertEqual(fr.method, "GET")
self.assertEqual(fr.params.get, {'a': '1'})


if __name__ == '__main__':
Expand Down

0 comments on commit 9e3b8cb

Please sign in to comment.