Skip to content

Commit 2727e24

Browse files
committed
Fixed a charset issue for multiparts
1 parent 978d35d commit 2727e24

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

reqable/reqable.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ def of(cls, data = None):
425425
else:
426426
type = cls.__type_none
427427
payload = None
428-
return cls(type, payload, 'utf-8')
428+
return cls(type, payload, 'UTF-8')
429429

430430
@classmethod
431431
def parse(cls, dict):
@@ -663,7 +663,7 @@ def _concatDisposition(name: str, filename: str, type: str):
663663
return None
664664

665665
@classmethod
666-
def text(cls, text: str, name: str = '', filename: str = '', headers = None, type = 'form-data'):
666+
def text(cls, text: str, name: str = '', filename: str = '', headers = None, type = 'form-data', charset= 'UTF-8'):
667667
if headers is None:
668668
headers = []
669669
headers.append(f'content-length: {len(text)}')
@@ -674,7 +674,10 @@ def text(cls, text: str, name: str = '', filename: str = '', headers = None, typ
674674
'headers': headers,
675675
'body': {
676676
'type': 1,
677-
'payload': text
677+
'payload': {
678+
'text': text,
679+
'charset': charset
680+
}
678681
}
679682
})
680683

0 commit comments

Comments
 (0)