Some webhook relay service like https://smee.io/ will make compact encoding [1] delivery bodies automatically when it transfers the delivery bodies it rececived.
If we signed delivery bodies with HMAC-SHA1, the client for https://smee.io/ won't be able to verify the delivery bodies directly.
Is it posiible to make the compact encoding delivery bodies from Launchpad webhook by default so it can save few network usage, improve the compatibilty for other programming languages [2], and avoid the signed delivery bodies problem of some webhook relay service like https://smee.io/?
Current Launchapd delivery body looks like,
{"action": "modified", "new": {"source_git_repository": "/~fourdollars/oem-dev-tools/+git/launchpad.api", "prerequisite_branch": null, "target_branch": null, "description": null, "source_branch": null, "registrant": "/~fourdollars", "queue_status": "Work in progress", "whiteboard": null, "source_git_path": "refs/heads/test", "prerequisite_git_path": null, "target_git_path": "refs/heads/master", "preview_diff": "/~fourdollars/oem-dev-tools/+git/launchpad.api/+merge/385119/+preview-diff/906725", "commit_message": null, "target_git_repository": "/~fourdollars/oem-dev-tools/+git/launchpad.api", "prerequisite_git_repository": null}, "old": {"source_git_repository": "/~fourdollars/oem-dev-tools/+git/launchpad.api", "prerequisite_branch": null, "target_branch": null, "description": null, "source_branch": null, "registrant": "/~fourdollars", "queue_status": "Needs review", "whiteboard": null, "source_git_path": "refs/heads/test", "prerequisite_git_path": null, "target_git_path": "refs/heads/master", "preview_diff": "/~fourdollars/oem-dev-tools/+git/launchpad.api/+merge/385119/+preview-diff/906725", "commit_message": null, "target_git_repository": "/~fourdollars/oem-dev-tools/+git/launchpad.api", "prerequisite_git_repository": null}, "merge_proposal": "/~fourdollars/oem-dev-tools/+git/launchpad.api/+merge/385119"}
Compact encoding delivery body looks like,
{"action":"modified","new":{"source_git_repository":"/~fourdollars/oem-dev-tools/+git/launchpad.api","prerequisite_branch":null,"target_branch":null,"description":null,"source_branch":null,"registrant":"/~fourdollars","queue_status":"Work in progress","whiteboard":null,"source_git_path":"refs/heads/test","prerequisite_git_path":null,"target_git_path":"refs/heads/master","preview_diff":"/~fourdollars/oem-dev-tools/+git/launchpad.api/+merge/385119/+preview-diff/906725","commit_message":null,"target_git_repository":"/~fourdollars/oem-dev-tools/+git/launchpad.api","prerequisite_git_repository":null},"old":{"source_git_repository":"/~fourdollars/oem-dev-tools/+git/launchpad.api","prerequisite_branch":null,"target_branch":null,"description":null,"source_branch":null,"registrant":"/~fourdollars","queue_status":"Needs review","whiteboard":null,"source_git_path":"refs/heads/test","prerequisite_git_path":null,"target_git_path":"refs/heads/master","preview_diff":"/~fourdollars/oem-dev-tools/+git/launchpad.api/+merge/385119/+preview-diff/906725","commit_message":null,"target_git_repository":"/~fourdollars/oem-dev-tools/+git/launchpad.api","prerequisite_git_repository":null},"merge_proposal":"/~fourdollars/oem-dev-tools/+git/launchpad.api/+merge/385119"}
--
[1]:
https://docs.python.org/3/library/json.html
Compact encoding:
>>> import json
>>> json.dumps([1, 2, 3, {'4': 5, '6': 7}], separators=(',', ':'))
'[1,2,3,{"4":5,"6":7}]''
[2]:
Golang: https://golang.org/pkg/encoding/json/#example_Marshal
Rust: https://docs.rs/json/0.12.4/json/
Ruby: https://ruby-doc.org/stdlib-2.6.3/libdoc/json/rdoc/JSON.html
Java: https://code.google.com/archive/p/json-simple/wikis/EncodingExamples.wiki
JavaScript: https://www.w3schools.com/js/js_json_stringify.asp (This is what https://smee.io/ used now.)
FYI, `orig == json.dumps( json.loads( minified) )` in Python so I can use json.dumps( json.loads( minified) ) to recover the delivery bodies and then check the signature.