During code review of #296, when I'd switched the add-notice API endpoint to use json.RawMessage for the data field, it no longer handled the case where the data field wasn't present (which is perfectly valid if you don't have data to attach). This made pebble notify fail like so:
$ pebble notify example.com/fizzbuzz
error: cannot decode notice data: unexpected end of JSON input
However, it does this work if you provide one or more data keys/values:
$ pebble notify example.com/fizzbuzz kee=valyou
Recorded notice 1
This PR is a trivial fix for the (first) no-data case, and also adds a test case for the no-data case.
During code review of #296, when I'd switched the add-notice API endpoint to use
json.RawMessage
for the data field, it no longer handled the case where the data field wasn't present (which is perfectly valid if you don't have data to attach). This madepebble notify
fail like so:However, it does this work if you provide one or more data keys/values:
This PR is a trivial fix for the (first) no-data case, and also adds a test case for the no-data case.