unjs / unjs/ofetch

the HTTP(S) Agent invalid

Open
#379 7 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5.4k
Forks
195
PR merge metrics
No merged PRs in 30d

Description

Environment

demo package.json

{
  "name": "demo",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "type": "module",
  "scripts": {
    "test": "node src/index.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "http-proxy-agent": "^7.0.2",
    "https-proxy-agent": "^7.0.4",
    "ofetch": "^1.3.4"
  }
}
Reproduction

The demo code

import { HttpProxyAgent } from 'http-proxy-agent'
import { ofetch } from 'ofetch'

const res1 = await ofetch('http://ip-api.com/json')

const res2 = await ofetch('http://ip-api.com/json', {
  agent: new HttpProxyAgent('http://127.0.0.1:7890'),
})

console.log('No Proxy IP: ' + res1.query)
console.log('Proxy IP: ' + res2.query)
Describe the bug

console print

No Proxy IP: 125.70.78.162
Proxy IP: 125.70.78.162

result is same, the set proxy is invalid

Additional context

No response

Logs

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduction package.json and demo code, then inspect how ofetch handles the agent option for Node.js requests. Verify the behavior with the provided proxy and confirm that the proxied and direct requests produce different results when the option is supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.