I would like to do a request with a header in the exact same order I write it down. But with Burp I have figured out that no matter how I write it in code, it seems to order the header in another way by itself.
Here is my Header order:
headers = {
'Host': 'localhost',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0',
'Accept': 'application/json, text/plain, */*',
'Accept-Language': 'de-DE',
'Accept-Encoding': 'gzip, deflate',
'Content-type': 'application/json',
'Content-Length': '31',
'Referer': 'https://localhost',
'Connection': 'close',
'Origin': 'https://localhost',
}
And this is the order in the request intercepted by Burp:
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:80.0) Gecko/20100101 Firefox/80.0
Accept-Encoding: gzip, deflate
Accept: application/json, text/plain, */*
Connection: close
Host: localhost
Accept-Language: de-DE
Content-type: application/json
Content-Length: 32
Referer: https://localhost
Origin: https://localhost
Versions and OS:
Windows 10
python3 --version
Python 3.8.6rc1
pip freeze |findstr requests
requests==2.24.0