Skip to content

Fix message error on README#1

Merged
kenichi merged 1 commit into
kenichi:mainfrom
speeddragon:patch-1
Jul 3, 2025
Merged

Fix message error on README#1
kenichi merged 1 commit into
kenichi:mainfrom
speeddragon:patch-1

Conversation

@speeddragon

Copy link
Copy Markdown
Contributor

I encountered an error while using the code example in the README.

** (ArgumentError) construction of binary failed: segment 1 of type 'binary': expected a binary but got: [~c"{", [[34, "title", 34], 58, 34, "teste", 34], [[44, [34, "body", 34], 58, 34, "", 34]], ~c"}"]
    (web_push_ex 0.1.0) lib/web_push.ex:145: WebPushEx.encrypt_payload/3
    (web_push_ex 0.1.0) lib/web_push.ex:27: WebPushEx.request/3

Added to_string() because :json.encode(message) isn't the same as Jason.encode!(message), since one generates a list, the other a binary.

Feel free to change to another example than the one I recommend.

@kenichi

kenichi commented Jul 3, 2025

Copy link
Copy Markdown
Owner

🤦🏽 Thanks for this! It is done correctly in the JOSE wrapper, but I missed this occurrence in the readme.

@kenichi kenichi merged commit c1e7917 into kenichi:main Jul 3, 2025
1 check 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