Skip to content

REST Client with Configurable Proxy for Deno

License

Notifications You must be signed in to change notification settings

01101sam/deno_proxy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

REST Client with Configurable Proxy for Deno

CI deno doc

This repository is currently experimental.

hello.json

{"text": "Hello"}

example.ts

import { exchange } from "https://raw.githubusercontent.com/chibat/rest_client_with_proxy/master/rest_client.ts";

const response = await exchange(
  {
    request: {
      url:
        "https://raw.githubusercontent.com/chibat/rest_client_with_proxy/master/test/hello.json",
    },
    proxy: {
      hostname: "proxy-server.example.com",
      port: 3128,
      credentials: { name: "user1", password: "test" },
    },
  },
);

type ResponseType = { text: string };

const responseText = response.json<ResponseType>().text;

console.log(responseText);

Execute

$ deno cache --reload example.ts
$ deno run --allow-net --unstable example.ts
Hello

About

REST Client with Configurable Proxy for Deno

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 97.7%
  • Shell 2.3%