FlorianREGAZ / Python-Tls-Client

Advanced HTTP Library
MIT License
678 stars 135 forks source link

fix bug sequence post give wrong content-type #116

Closed fancy45daddy closed 1 month ago

fancy45daddy commented 7 months ago

import tls_client client = tls_client.Session() print(client.post('https://httpbin.org/post', json={'a':'b'}).json() {'args': {}, 'data': '{"a": "b"}', 'files': {}, 'form': {}, 'headers': {'Accept': '/', 'Accept-Encoding': 'gzip, deflate, br', 'Content-Length': '10', 'Content-Type': 'application/json', 'Host': 'httpbin.org', 'User-Agent': 'tls-client/1.0.1', 'X-Amzn-Trace-Id': 'Root=1-65f57b99-62f659ac717afad079b6f9f6'}, 'json': {'a': 'b'}, 'origin': '24.6.214.76', 'url': 'https://httpbin.org/post'} print(client.post('https://httpbin.org/post', data={'a':'b'}).json() # content-type show be application/x-www-form-urlencoded {'args': {}, 'data': 'a=b', 'files': {}, 'form': {}, 'headers': {'Accept': '/', 'Accept-Encoding': 'gzip, deflate, br', 'Content-Length': '3', 'Content-Type': 'application/json', 'Host': 'httpbin.org', 'User-Agent': 'tls-client/1.0.1', 'X-Amzn-Trace-Id': 'Root=1-65f57ba4-5caf4a7701cfc5eb735aac2d'}, 'json': None, 'origin': '24.6.214.76', 'url': 'https://httpbin.org/post'}

enodr commented 5 months ago

This PR fixes #122 #119 #117 #83 and probably more issues.

This is the correct fix for the decoding problem with binary content. Please can you merge in master ?

Sirorezka commented 4 months ago

Hi, sry, when this commit will be merged?)