Handle python session requests/response in modify_chunk_response plugin #1351
ananth-sivam
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
@abhinavsingh
I have used the modify_chunk_response plugin to modify an upstream response header and publish it to client.
Here the client is using python requests.Session() to do GET/POST/PUT via https.
Below is the UT that I have to mimick the client and the last assert is failing as
assert 'https://httpbin.org/get' == 'https://httpbin.org/post'
UT
session = requests.Session()
r1 = session.get( "https://httpbin.org/get", proxies={"https": "http://127.0.0.1:8899"}, verify=False, )
assert r1.json().get("url") == "https://httpbin.org/get"
r2 = session.post( "https://httpbin.org/post", proxies={"https": "http://127.0.0.1:8899"}, verify=False, )
assert r2.json().get("url") == 'https://httpbin.org/post'
OR below was executed after starting the
python -m proxy --plugins proxy.plugin.ModifyChunkResponsePlugin
Below is the print output
R1: http://httpbin.org/get
R2: http://httpbin.org/get
proxy version: 2.4.3
Any help is appreciated.
Beta Was this translation helpful? Give feedback.
All reactions