Closed zdwolfe closed 1 year ago
Nice, so this works @zdwolfe but I was thinking of a different approach.
The actual message that broke the utf-8 encoding wasn't a standard webhook body, it was a text message sent by send_message
. Something like this:
Found more than 5 matching campsites (16) on the first try. Try searching online instead. camply is only sending the first 5 notifications. Go Get your campsite! π
I'm wondering if we should be disabling send_message
altogether with a no-op and only enabling send_campsites
. This way the ony messages that get sent to the webhook are valid JSON campsites. We can also ensure utf-8 encoding while we're at it too.
Let me know what you think?
Oh, I see! Disabling send_message
sounds good to me, though I also agree utf-8 might be worth keeping around.
Resolved by #303
Description
Fixes https://github.com/juftin/camply/issues/302
Specify utf-8 body encoding on webhook requests. The emojis in campsites json body cannot be encoded with latin-1 encoding and
camply
crashes. The utf-8 encoding is the json spec character encoding, so it seems like an OK default stance forcamply
to take.Before
..would crash with
Has This Been Tested?
In background shell, start a simple webhook handler
then run:
..and the webhook handler prints:
..also,
Checklist:
.pre_commit
on all my code(also, this is the first GitHub PR I've ever made, so apologies if something's not quite right).