Skip to content

Conversation

@wapacro
Copy link
Contributor

@wapacro wapacro commented Nov 13, 2025

Hey there 👋

In order to support Declarative Web Push messages, which aim to reduce the complexity of using push on the web in general and address some challenges like privacy & battery life on mobile, a well-defined JSON body needs to be sent as payload to the push service. See also https://webkit.org/blog/16535/meet-declarative-web-push.

Since this payload is always a JSON object, the content type header of the HTTP request should be set accordingly. Which is why this pull request introduces the ability to configure on a global or per-notification basis the content type that should be set for the HTTP request to the push service.

While in practice most payloads probably are a JSON object already, I opted to make the content type header option an explicit opt-in and leave the default at application/octet-stream in order to not introduce any breaking changes.

Video 1: Sample app as-is
https://github.com/user-attachments/assets/6fbde6ed-3edb-4b30-a7a7-fe93f1f09e24

Video 2: Sample app modified with contentType "application/json" option
https://github.com/user-attachments/assets/ed71be90-79ad-46c4-b2dd-446bea16cc05

Copy link
Member

@Minishlink Minishlink left a comment

Choose a reason for hiding this comment

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

Thank you!

@Minishlink Minishlink merged commit 5c185f7 into web-push-libs:master Nov 13, 2025
9 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.

2 participants