fix encoding of text payloads to utf-8

This commit is contained in:
dcore94 2022-09-07 16:49:06 +02:00
parent 07f8e5df56
commit 6bd8fa3aab
1 changed files with 2 additions and 0 deletions

View File

@ -32,6 +32,8 @@ class Plugin(PyExecPlugin):
#logging.getLogger("pyexec").debug("%s - %s - %s - %s",self.method, self.url, self.contenttype, self.accept)
if self.contenttype != None and self.contenttype.find("json") != -1:
self.request = requests.Request(self.method, self.url, headers=self.headers, json = self.body)
elif self.contenttype != None and self.contenttype.find("text") != -1:
self.request = requests.Request(self.method, self.url, headers=self.headers, data = self.body.encode('utf-8'))
else:
self.request = requests.Request(self.method, self.url, headers=self.headers, data = self.body, params = self.params)