Makes a GET request to the given endpoint and checks the response. endpoint str: The endpoint to make the request to. expected_status_code int: The expected status code of the response. headers dict: The headers to send with the request. should_check_response bool: A boolean to
(
endpoint: str,
expected_status_code: int = 200,
headers: dict = {},
should_check_response: bool = True,
)
| 17 | |
| 18 | |
| 19 | def get( |
| 20 | endpoint: str, |
| 21 | expected_status_code: int = 200, |
| 22 | headers: dict = {}, |
| 23 | should_check_response: bool = True, |
| 24 | ) -> requests.Response: |
| 25 | """ |
| 26 | Makes a GET request to the given endpoint and checks the response. |
| 27 | |
| 28 | endpoint str: The endpoint to make the request to. |
| 29 | expected_status_code int: The expected status code of the response. |
| 30 | headers dict: The headers to send with the request. |
| 31 | should_check_response bool: A boolean to indicate if the status code and headers should be checked. |
| 32 | """ |
| 33 | endpoint = endpoint.lstrip("/") |
| 34 | response = requests.get(f"{BASE_URL}/{endpoint}", headers=headers) |
| 35 | if should_check_response: |
| 36 | check_response(response, expected_status_code) |
| 37 | return response |
| 38 | |
| 39 | |
| 40 | def post( |