forked from TrueCloudLab/frostfs-testlib
[#310] Added classmethod decorator in Http client
Signed-off-by: Dmitriy Zayakin <d.zayakin@yadro.com>
This commit is contained in:
parent
f24bfc06fd
commit
4677709d13
1 changed files with 2 additions and 0 deletions
|
@ -50,6 +50,7 @@ class HttpClient:
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
@classmethod
|
||||||
def _attach_response(self, response: httpx.Response):
|
def _attach_response(self, response: httpx.Response):
|
||||||
request = response.request
|
request = response.request
|
||||||
|
|
||||||
|
@ -88,6 +89,7 @@ class HttpClient:
|
||||||
reporter.attach(report, "Requests Info")
|
reporter.attach(report, "Requests Info")
|
||||||
reporter.attach(curl_request, "CURL")
|
reporter.attach(curl_request, "CURL")
|
||||||
|
|
||||||
|
@classmethod
|
||||||
def _create_curl_request(self, url: str, method: str, headers: httpx.Headers, data: str) -> str:
|
def _create_curl_request(self, url: str, method: str, headers: httpx.Headers, data: str) -> str:
|
||||||
headers = " ".join(f'-H "{name.title()}: {value}"' for name, value in headers.items())
|
headers = " ".join(f'-H "{name.title()}: {value}"' for name, value in headers.items())
|
||||||
data = f" -d '{data}'" if data else ""
|
data = f" -d '{data}'" if data else ""
|
||||||
|
|
Loading…
Reference in a new issue