Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/http/util.ts>stringifyResponse

A JavaScript extension package for building strong and modern applications.
Latest
function stringifyResponse
import { stringifyResponse } from "https://deno.land/x/ayonli_jsext@v0.9.72/http/util.ts";

Converts the response object to text format.

Examples

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!"

Returns

Promise<string>