mirror of
https://github.com/curlconverter/curlconverter.git
synced 2022-05-22 02:35:29 +03:00
Warn users that Requests doesn't support HTTP/2 (#361)
This commit is contained in:
committed by
GitHub
parent
82fdaa0dba
commit
a532bd4158
1
fixtures/curl_commands/get_http2_warning.sh
Normal file
1
fixtures/curl_commands/get_http2_warning.sh
Normal file
@@ -0,0 +1 @@
|
||||
curl --http2 example.com
|
||||
4
fixtures/python/get_http2_warning.py
generated
Normal file
4
fixtures/python/get_http2_warning.py
generated
Normal file
@@ -0,0 +1,4 @@
|
||||
import requests
|
||||
|
||||
# Warning: this was an HTTP/2 request but requests only supports HTTP/1.1
|
||||
response = requests.get('http://example.com')
|
||||
@@ -448,6 +448,12 @@ export const _toPython = request => {
|
||||
} else if (filesString) {
|
||||
pythonCode += filesString + '\n'
|
||||
}
|
||||
|
||||
if (request.http2 || request.http3) {
|
||||
// TODO: warn users out of band, not in the generated code
|
||||
const version = request.http2 ? '2' : '3'
|
||||
pythonCode += `# Warning: this was an HTTP/${version} request but requests only supports HTTP/1.1\n`
|
||||
}
|
||||
pythonCode += requestLine
|
||||
|
||||
if (jsonDataString && !jsonDataStringRoundtrips) {
|
||||
|
||||
Reference in New Issue
Block a user