Commit 73a27db
Use requests' json argument when passing JSON to the taskcluster API
When triggering hooks, the previous code was serializing the JSON itself
then passing it straight to taskcluster as a string with no content
type. This currently works because the taskcluster proxy has a
workaround (see taskcluster/taskcluster#3521)
that sets the content type to application/json if it's missing from a
request with a non empty body. This means that if that workaround was
ever removed or if this script tries to target taskcluster directly
without the proxy, the request would fail. Just use
`requests.post(json=` and get serialization and the header for free.
The manual json.dumps() and the \n to space replace were leftovers from
when the payload was shelled out through `echo -n '...' |
taskcluster-darwin-amd64` in the past, where embedded newlines broke the
quoted shell string.1 parent 479a4a2 commit 73a27db
1 file changed
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | 8 | | |
10 | 9 | | |
11 | 10 | | |
| |||
442 | 441 | | |
443 | 442 | | |
444 | 443 | | |
445 | | - | |
446 | 444 | | |
447 | 445 | | |
448 | 446 | | |
449 | 447 | | |
450 | 448 | | |
451 | | - | |
| 449 | + | |
452 | 450 | | |
453 | 451 | | |
454 | 452 | | |
| |||
0 commit comments