import { stringifyResponse } from "https://deno.land/x/ayonli_jsext@v0.9.72/workerd/http.ts";
Converts the response object to text format.
Examples
Example 1
Example 1
import { stringifyResponse } from "@ayonli/jsext/http";
const res = new Response("Hello, World!", {
headers: {
"Content-Type": "text/plain",
},
});
const message = await stringifyResponse(res);
console.log(message);
// "HTTP/1.1 200 OK\r\n" +
// "Content-Type: text/plain\r\n" +
// "Content-Length: 12\r\n" +
// "\r\n" +
// "Hello, World!"
Parameters
res: Response