Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/test_the_test/test_mock_ffe_agentless_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def test_mock_ffe_agentless_backend_serves_fixture_and_tracks_metadata(worker_id
timeout=5,
)
response.raise_for_status()
assert response.headers["Content-Length"] == str(len(response.content))

payload = response.json()
assert payload["data"]["type"] == UFC_RESPONSE_TYPE
Expand Down
5 changes: 4 additions & 1 deletion utils/docker_fixtures/_mock_ffe_agentless_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ def _handle_config(self) -> None:
self.send_response(status_code)
for key, value in headers.items():
self.send_header(key, value)
self.send_header("Content-Length", str(len(body)))
self.end_headers()
if body:
self.wfile.write(body)
Expand Down Expand Up @@ -229,10 +230,12 @@ def _handle_responses_control(self) -> None:

def _write_json(self, status_code: HTTPStatus, payload: dict[str, Any] | MockFFEAgentlessBackendStatus) -> None:
with contextlib.suppress(BrokenPipeError, ConnectionResetError):
body = json.dumps(payload).encode("utf-8")
self.send_response(status_code)
self.send_header("Content-Type", "application/json")
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(json.dumps(payload).encode("utf-8"))
self.wfile.write(body)


def _has_auth(headers: Mapping[str, str]) -> bool:
Expand Down
Loading