Openstatus www.openstatus.dev

fix headers (#1615)

authored by

Thibault Le Ouay and committed by
GitHub
330f418b 63c595a4

+15 -5
+1 -1
packages/notifications/webhook/src/index.test.ts
··· 29 29 expect.objectContaining({ 30 30 method: "post", 31 31 body: expect.any(String), 32 - headers: undefined, 32 + headers: { "Content-Type": "application/json" }, 33 33 }), 34 34 ); 35 35
+14 -4
packages/notifications/webhook/src/index.ts
··· 40 40 body: JSON.stringify(body), 41 41 headers: notificationData.webhook.headers 42 42 ? transformHeaders(notificationData.webhook.headers) 43 - : undefined, 43 + : { 44 + "Content-Type": "application/json", 45 + }, 44 46 }); 45 47 } catch (err) { 46 48 console.log(err); ··· 84 86 body: JSON.stringify(body), 85 87 headers: notificationData.webhook.headers 86 88 ? transformHeaders(notificationData.webhook.headers) 87 - : undefined, 89 + : { 90 + "Content-Type": "application/json", 91 + }, 88 92 }); 89 93 } catch (err) { 90 94 console.log(err); ··· 126 130 body: JSON.stringify(body), 127 131 headers: notificationData.webhook.headers 128 132 ? transformHeaders(notificationData.webhook.headers) 129 - : undefined, 133 + : { 134 + "Content-Type": "application/json", 135 + }, 130 136 }); 131 137 } catch (err) { 132 138 console.log(err); ··· 156 162 const response = await fetch(url, { 157 163 method: "post", 158 164 body: JSON.stringify(body), 159 - headers: headers ? transformHeaders(headers) : undefined, 165 + headers: headers 166 + ? transformHeaders(headers) 167 + : { 168 + "Content-Type": "application/json", 169 + }, 160 170 }); 161 171 if (!response.ok) { 162 172 throw new Error("Failed to send test");