Skip to content

Commit 15aadcc

Browse files
committed
Avoid reporting [object Object] in the Azure Function logs
Such a string is pretty unhelpful. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 2ad8009 commit 15aadcc

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

GitForWindowsHelper/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ const validateGitHubWebHook = require('./validate-github-webhook')
22

33
module.exports = async function (context, req) {
44
const withStatus = (status, headers, body) => {
5+
if (typeof body === 'object') try {
6+
body = JSON.stringify(null, 2)
7+
} catch (e) {
8+
context.log(e)
9+
}
510
context.res = {
611
status,
712
headers,

0 commit comments

Comments
 (0)