For example take this app.py and run it with python3 -m flask run --cert=adhoc.
from flask import Flask
app = Flask(__name__)
@app.route('/', methods=["GET", "POST"])
def hello_world():
return {"access_token": "aa" * 50000}
How could sending data truncate the response?
>>> import requests
>>> len(requests.post('https://127.0.0.1:5000/', verify=False).content)
100020
>>> len(requests.post('https://127.0.0.1:5000/', data={'a':'b'}, verify=False).content)
81920
PS 1: It works as expected without SSL;
PS 2: GET produces the same behaviour;
PS 3: Curl produces the correct result:
$ curl -s -k -X POST https://127.0.0.1:5000/ -H 'Content-Type: application/json' -d '{"a":"b"}' | wc -m
100020
PS 4: I reported this as a bug on requests' github.