Skip to content

Commit

Permalink
Merge pull request #2 from Rocketseat/feat/webhooklog-headers
Browse files Browse the repository at this point in the history
feat: add request headers to company webhook log
  • Loading branch information
josepholiveira authored Mar 3, 2024
2 parents bae98c2 + 88a6642 commit 743f972
Show file tree
Hide file tree
Showing 6 changed files with 1,100 additions and 12 deletions.
22 changes: 22 additions & 0 deletions apps/web/src/app/(app)/settings/developers/logs/[logId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export default async function WebhookLogsDetails({
? getParsedText(webhookLog.requestBody)
: null

const parsedRequestHeaders = webhookLog.requestHeaders
? getParsedText(webhookLog.requestHeaders)
: null

const parsedResponseBody = webhookLog.responseBody
? getParsedText(webhookLog.responseBody)
: null
Expand All @@ -49,6 +53,13 @@ export default async function WebhookLogsDetails({
})
: null

const highlightedRequestHeaders = parsedRequestHeaders
? highlighter.codeToHtml(parsedRequestHeaders.code, {
lang: parsedRequestHeaders.lang,
themes: { light: 'rose-pine-dawn', dark: 'vesper' },
})
: null

const highlightedResponseBody = parsedResponseBody
? highlighter.codeToHtml(parsedResponseBody.code, {
lang: parsedResponseBody.lang,
Expand Down Expand Up @@ -137,6 +148,17 @@ export default async function WebhookLogsDetails({
</Table>
</div>
<Separator />
{highlightedRequestHeaders && (
<div className="space-y-2">
<span className="text-sm font-semibold tracking-tight">
Request Headers
</span>
<div
className="max-h-72 overflow-y-scroll bg-muted p-6 text-sm"
dangerouslySetInnerHTML={{ __html: highlightedRequestHeaders }}
/>
</div>
)}
{highlightedRequestBody && (
<div className="space-y-2">
<span className="text-sm font-semibold tracking-tight">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "company_webhook_logs" ADD COLUMN "request_headers" text;
Loading

0 comments on commit 743f972

Please sign in to comment.