forwardemail / forwardemail/superagent

The agent() set default behavior is nonsensical

Open
#1,783 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
16.6k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

No mean to offend, but I find that agent's default setting behavior to be nonsensical.

I want the agent to manage the cookie for me. But I still need to send query with different query parameters in the requests.
Thinking this is a pretty common and reasonable use case. After all that's what happens if you make http request from a browser.

If I am not mistaken, the current api virtually prohibits you from doing that.
For example
```js
const agent = superagent.agent()
await agent.get('/xyz').query({ id: 1 })
await agent.get('/xyz') // with ?id=1
await agent.get('/xyz').query({id: undefined }) // without ?id=1
await agent.get('/xyz') // with ?id=1 again
```
The current api means the first query parameter you send automatically becomes the default for all of the subsequent requests and without any way of removing that default.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.