JSON endpoints
Target format
Section titled “Target format”json://<host>[:<port>]/<path>jsons://<host>[:<port>]/<path>json: sends HTTP; jsons: sends HTTPS.
import { send } from 'statocysts'
await send('jsons://example.com/notifications', { title: 'Deployment complete', body: 'Production is healthy.',})The default body is:
{ "title": "Deployment complete", "body": "Production is healthy."}body is omitted when the notification has no body.
Add headers and body fields
Section titled “Add headers and body fields”A query key whose decoded value starts with a space becomes a request header. A key starting with : becomes an additional body property.
jsons://example.com/notifications?%20Authorization=Bearer%20TOKEN&:environment=productionThis sends Authorization: Bearer TOKEN and adds "environment": "production" to the JSON body. Other query parameters remain in the endpoint URL.
Provider options
Section titled “Provider options”json.send() and jsons.send() accept ofetch FetchOptions directly:
import { jsons } from 'statocysts'
await jsons.send(target, notification, { timeout: 5000, retry: 2,})