Skip to content

Conversation

JosePineiro
Copy link

This PR extends the _setContentTypeFromPath method to correctly identify and assign Content-Type headers for .webp (image/webp) and .avif (image/avif) files. Additionally, all HTTP headers are now formatted in Title Case, aligning with RFC 7231 and improving consistency across responses.

Developers are encouraged to adopt AVIF or WebP formats over legacy image types such as GIF, PNG, or JPEG. Both formats are fully supported by all major modern browsers and typically offer significant file size reductions (often 50% or more) without perceptible quality loss.

Conversion of assets is straightforward using tools like squoosh.app (free and online), which supports batch optimization and visual comparisons across formats.

This PR extends the _setContentTypeFromPath method to correctly identify and assign Content-Type headers for .webp (image/webp) and .avif (image/avif) files. Additionally, all HTTP headers are now formatted in Title Case, aligning with RFC 7231 and improving consistency across responses.

Developers are encouraged to adopt AVIF or WebP formats over legacy image types such as GIF, PNG, or JPEG. Both formats are fully supported by all major modern browsers and typically offer significant file size reductions (often 50% or more) without perceptible quality loss.

Conversion of assets is straightforward using tools like squoosh.app (free and online), which supports batch optimization and visual comparisons across formats.
src/literals.h Outdated
@@ -3,194 +3,198 @@

#pragma once

namespace asyncsrv {
namespace asyncsrv
{
Copy link
Member

Choose a reason for hiding this comment

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

please do not change the styling

Copy link
Member

Choose a reason for hiding this comment

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

I will add the label and see of lint solves that.

@mathieucarbou
Copy link
Member

@JosePineiro : please have a look at #230 thanks !

@me-no-dev
Copy link
Member

This PR contains more than it says in the title. I suggest to split it in two PRs, one for adding the two types and another for changing the case of strings

me-no-dev requests fulfilled:
- please do not change the styling
- to split it in two PRs
@mathieucarbou mathieucarbou merged commit 7a8fa42 into ESP32Async:main Jul 18, 2025
34 checks passed
@JosePineiro JosePineiro deleted the feature/http-content-type-webp-avif branch July 18, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants