mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-19 07:11:37 +00:00
12 lines
361 B
TypeScript
12 lines
361 B
TypeScript
// Discord helper module supports test http helpers behavior.
|
|
export function jsonResponse(body: unknown, status = 200): Response {
|
|
return new Response(JSON.stringify(body), { status });
|
|
}
|
|
|
|
export function urlToString(url: Request | URL | string): string {
|
|
if (typeof url === "string") {
|
|
return url;
|
|
}
|
|
return "url" in url ? url.url : String(url);
|
|
}
|