From e9b7bf9ad2cddbecb9a84b5e655a591ab6f72df7 Mon Sep 17 00:00:00 2001 From: yuyinws Date: Tue, 22 Nov 2022 09:50:52 +0800 Subject: [PATCH 1/4] docs: add agent option usage --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 0185500a..251f1502 100644 --- a/README.md +++ b/README.md @@ -218,6 +218,16 @@ await ofetch('/movies', { }) ``` +## 💡 Adding agent +If you need use HTTP(S) Agent, can use `agent` option with `https-proxy-agent` +```js +import { HttpsProxyAgent } from "https-proxy-agent"; + +await ofetch('/api', { + agent: new HttpsProxyAgent('http://example.com') +}) +``` + ## 🍣 Access to Raw Response If you need to access raw response (for headers, etc), can use `ofetch.raw`: From 476ea77bfe0ef8ae82dfdf964f3ae63fedebe60e Mon Sep 17 00:00:00 2001 From: yuyinws Date: Tue, 22 Nov 2022 09:52:57 +0800 Subject: [PATCH 2/4] docs: typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 251f1502..066dc3d4 100644 --- a/README.md +++ b/README.md @@ -219,7 +219,7 @@ await ofetch('/movies', { ``` ## 💡 Adding agent -If you need use HTTP(S) Agent, can use `agent` option with `https-proxy-agent` +If you need use HTTP(S) Agent, can add `agent` option with `https-proxy-agent` ```js import { HttpsProxyAgent } from "https-proxy-agent"; From e868484550e63e804444468a1da7c3e7e0e14a0b Mon Sep 17 00:00:00 2001 From: Nozomu Ikuta <16436160+NozomuIkuta@users.noreply.github.com> Date: Thu, 12 Jan 2023 15:03:25 +0900 Subject: [PATCH 3/4] docs: modify format --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 066dc3d4..7991fe82 100644 --- a/README.md +++ b/README.md @@ -218,8 +218,9 @@ await ofetch('/movies', { }) ``` -## 💡 Adding agent -If you need use HTTP(S) Agent, can add `agent` option with `https-proxy-agent` +## 💡 Adding HTTP(S) Agent + +If you need use HTTP(S) Agent, can add `agent` option with `https-proxy-agent`: ```js import { HttpsProxyAgent } from "https-proxy-agent"; From b2f0ca3c889fc831f25b60752800da7881c37d85 Mon Sep 17 00:00:00 2001 From: Nozomu Ikuta <16436160+NozomuIkuta@users.noreply.github.com> Date: Thu, 12 Jan 2023 15:04:13 +0900 Subject: [PATCH 4/4] docs: add line break --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7991fe82..3ba6d0fa 100644 --- a/README.md +++ b/README.md @@ -221,6 +221,7 @@ await ofetch('/movies', { ## 💡 Adding HTTP(S) Agent If you need use HTTP(S) Agent, can add `agent` option with `https-proxy-agent`: + ```js import { HttpsProxyAgent } from "https-proxy-agent";