"use client"; import { useState } from "react"; export default function Home() { const [targetUrl, setTargetUrl] = useState("https://httpbin.org/anything"); const [method, setMethod] = useState("GET"); const [requestBody, setRequestBody] = useState(JSON.stringify({ message: "Hello from Edge Proxy", timestamp: Date.now(), }, null, 2)); const [headerKey, setHeaderKey] = useState(""); const [headerValue, setHeaderValue] = useState(""); const [response, setResponse] = useState(null); const [loading, setLoading] = useState(false); const methods = ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"]; async function sendRequest() { setLoading(true); setResponse(null); const headers: Record = { 'x-relay-target': targetUrl, 'Content-Type': 'application/json' }; if (headerKey && headerValue) { headers[headerKey] = headerValue; } try { const start = Date.now(); const fetchOptions: any = { method, headers }; if (!['GET', 'HEAD', 'OPTIONS'].includes(method) && requestBody) { fetchOptions.body = requestBody; } const res = await fetch('/api/proxy', fetchOptions); const elapsed = Date.now() - start; let responseText = ''; const contentType = res.headers.get('content-type') || ''; if (contentType.includes('application/json')) { const data = await res.json(); responseText = JSON.stringify(data, null, 2); } else { responseText = await res.text(); } const headersObj: Record = {}; res.headers.forEach((value, key) => { headersObj[key] = value; }); setResponse({ status: res.status, statusText: res.statusText, time: `${elapsed}ms`, body: responseText, headers: JSON.stringify(headersObj, null, 2) }); } catch (err: any) { setResponse({ status: 'Error', body: err.message, headers: '-' }); } finally { setLoading(false); } } return (

Edge Proxy Relay Test

Standardized Next.js Migration

Target Configuration

setTargetUrl(e.target.value)} />
{['https://httpbin.org/anything', 'https://httpbin.org/get', 'https://jsonplaceholder.typicode.com/posts/1'].map(url => ( ))}

Method

{methods.map(m => ( ))}

Body (JSON)