Fix ntfy: URL-encode Title header to avoid non-ASCII rejection
HTTP headers must be ASCII-only. Emoji in the Title header caused "Invalid character in header content" errors. ntfy.sh accepts URL-encoded header values, so encodeURIComponent() fixes it. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
8d50d3cb61
commit
d46a37a219
2 files changed
+18
-10
No files matched your search
+5
-1
@@ -1567,7 +1567,11 @@ app.post('/api/test-ntfy', async (req, res) => {
|
||||
const base = (ntfy_url || 'https://ntfy.sh').replace(/\/$/, '');
|
||||
try {
|
||||
await axios.post(`${base}/${ntfy_topic}`, 'This is a test notification from SkyWatch', {
|
||||
headers: { Title: '🔔 SkyWatch Test', Priority: 'default', Tags: 'white_check_mark' },
|
||||
headers: {
|
||||
Title: encodeURIComponent('SkyWatch Test'),
|
||||
Priority: 'default',
|
||||
Tags: 'white_check_mark',
|
||||
},
|
||||
});
|
||||
res.json({ message: 'Test notification sent to ntfy!' });
|
||||
} catch (error) {
|
||||
|
||||
Reference in new issue
Block a user