Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added fake image response #105

Merged
merged 3 commits into from
Jan 2, 2025
Merged

Added fake image response #105

merged 3 commits into from
Jan 2, 2025

Conversation

kunwar-reworkd
Copy link
Contributor

@kunwar-reworkd kunwar-reworkd commented Dec 31, 2024

Important

Add fake image response for image and media resources in UnnecessaryResourceHandler and update harambe-core and harambe-sdk to version 0.59.0.

  • Behavior:
    • UnnecessaryResourceHandler in handlers.py now returns a fake image for image and media resource types using a base64 encoded PNG.
  • Version Updates:
    • Update harambe-core and harambe-sdk versions to 0.59.0 in pyproject.toml and uv.lock.
    • Update harambe_core dependency in sdk/pyproject.toml to 0.59.0.

This description was created by Ellipsis for be9b650. It will automatically update as commits are pushed.

if (
resource_type in ["image", "media", "font"]
if resource_type in ["image", "media"]:
fake_img = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is constant may aswell store the b64 version of this. I would put it at the top as FAKE_1x1_img

@@ -74,13 +78,15 @@ def captured_url(self) -> str | None:
return self._new_pages[0] if self._new_pages else None


class UnnecessaryResourceHandler(AbstractHandler):
class UnnecessaryResourceHandler:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UnnecessaryResourceHandler should inherit from AbstractHandler to maintain consistency and ensure it follows the expected interface for handlers.

@kunwar-reworkd kunwar-reworkd merged commit b655d27 into main Jan 2, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants