Request Inspector
Inspect HTTP requests and responses with status codes, headers, timing, format detection, and cURL generation.
- project:"drift-dashboard"
- branch:"main"
- commit:"8f3e21a"
- autoRollback:true
Keyboard
- ←→
- Switch between tabs
- HomeEnd
- First or last tab
On this page
Installation
The CLI also installs the npm packages and registry items it builds on, and reads the style in your components.json to pick the Base UI or Radix build.
Usage
"use client"
import { RequestInspector } from "@/components/ui/request-inspector"
export function ApiLogDetail() {
return (
<RequestInspector
request={{
method: "POST",
url: "https://api.example.com/v1/orders",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer sec_test_token123",
},
body: {
items: [{ sku: "DRIFT-TSHIRT", quantity: 2 }],
currency: "usd",
},
}}
response={{
status: 201,
statusText: "Created",
headers: {
"Content-Type": "application/json",
"X-Request-Id": "req_8849b2",
},
body: {
id: "ord_91823",
status: "confirmed",
total: 5800,
},
durationMs: 142,
}}
/>
)
}Examples
Resource lookup
Inspect a standard GET API call with response caching, headers, and formatted JSON body.
Webhook delivery
Inspect incoming webhooks with custom signature verification headers and plain text responses.
- id:"evt_3Mvw92LkdIwHu7ix0Sne85Y"
- object:"event"
- type:"payment_intent.succeeded"
- created:1793356800
- data:{…}
- object:{…}
- id:"pi_3Mvw92LkdIwHu7ix0"
- amount:25000
- currency:"usd"
- status:"succeeded"
Validation error
Review client error responses with status badge color mapping and field error details.
- error:"validation_failed"
- message:"The seat quantity must be a positive integer."
- field:"seats"
- code:422
API reference
RequestInspector
Inspect HTTP requests and responses with status badge, duration, headers, query parameters, body format detection, and cURL generation.
| Prop | Type | Default |
|---|---|---|
requestRequiredRequestInspectorRequestRequest details including method, url, optional headers, and body. | RequestInspectorRequest | |
responseRequestInspectorResponseResponse details including status, statusText, headers, body, and durationMs. | RequestInspectorResponse | |
defaultTab"request" | "response" | "headers" | "timing"Default"request"Initial active tab when uncontrolled. | "request" | "response" | "headers" | "timing" | "request" |
tab"request" | "response" | "headers" | "timing"Controlled active tab. | "request" | "response" | "headers" | "timing" | |
onTabChange(tab: "request" | "response" | "headers" | "timing") => voidCallback fired when the active tab changes. | (tab: "request" | "response" | "headers" | "timing") => void | |
sensitiveHeadersstring[]DefaultDEFAULT_SENSITIVE_HEADERSList of header names to mask by default and reveal with secret-field. Passing this replaces defaults; spread DEFAULT_SENSITIVE_HEADERS to retain them. | string[] | DEFAULT_SENSITIVE_HEADERS |
hideCurlbooleanDefaultfalseWhether to hide the Copy as cURL action button. | boolean | false |
Other props go to the <div>.
buildCurlCommand, quoteShell, isSensitiveHeader, normalizeHeaders, parseQueryParams, parseBody, formatDuration, getStatusBadgeClass, getStatusText
buildCurlCommand(request: RequestInspectorRequest, options?: { maskSensitive?: boolean; sensitiveHeaders?: string[] }): string; quoteShell(arg: string): string; isSensitiveHeader(name: string, sensitiveHeaders?: string[]): boolean; normalizeHeaders(headers?: RequestInspectorHeaders | [string, string][]): [string, string][]; parseQueryParams(url: string): [string, string][]; parseBody(body: unknown): { isJson: boolean; jsonValue?: unknown; text: string }; formatDuration(ms?: number): string; getStatusBadgeClass(status: number): { className: string; label: string }; getStatusText(status: number): stringPure logic helpers imported from @/lib/request-inspector-utils.