Skip to content

Conversation

@jfernandez
Copy link
Owner

@jfernandez jfernandez commented Oct 2, 2025

Add ETag caching to reduce bandwidth when serving the bundled Mermaid library. ETags are generated from the crate version at startup.

@jfernandez jfernandez requested a review from Copilot October 2, 2025 04:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds ETag caching support for the bundled Mermaid JavaScript library to reduce bandwidth usage. The ETag is generated from a content hash at startup and enables HTTP conditional requests.

  • Implements ETag generation using a hash of the Mermaid.js content
  • Adds HTTP conditional request handling with If-None-Match header support
  • Updates cache control headers to use "public, no-cache" for proper revalidation

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/app.rs Implements ETag generation, conditional request handling, and updated response headers for mermaid.min.js
tests/integration_test.rs Adds comprehensive test coverage for ETag caching behavior including 200, 304, and conditional request scenarios

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Add ETag caching to reduce bandwidth when serving the bundled Mermaid
library. ETags are generated from the cargo version at startup.
@jfernandez jfernandez merged commit 3e143db into main Oct 2, 2025
5 checks passed
@jfernandez jfernandez deleted the etags branch October 2, 2025 15:29
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.

2 participants