NOTICE: 2021/04/09 no longer hosts typescript files. Use

Agent API

Agent is low level interface for managing HTTP/1.1 Keep-Alive connection to the host.

It is the persist HTTP client to the same host and can be used as a connection pool. In most cases, fetch is enough for sending HTTP request but is useful to manage Keep-Alive connections.

import { createAgent } from "[email protected]/mod.ts";

async function main() {
  const agent = createAgent("");
  const res1 = await agent.send({ method: "GET", path: "/@/server.ts" });
  const res2 = await agent.send({ method: "GET", path: "/@/router.ts" });