forwardemail / forwardemail/superagent
[feat] Configuring request header before specifying the method
- Dominant language
- JavaScript
- Stars
- 16.6k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
## Configuring request header before specifying the method, or creating agent instances that keep memory of what we configured him with.
How I would like Superagent to be:
```javascript
const superagent = require('superagent')
const agent = superagent(app).createAgent()
agent.set({
accessToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',
refreshToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'
})
agent.get('/currentUser')
```
## Checklist
- [X] I have searched through GitHub issues for similar issues.
- [X] I have completely read through the README and documentation.
Contributor guide
Research direction
No implementation files or tests are named. Start by tracing the existing request-construction and header-setting API around the documented Superagent usage, then compare it with the proposed createAgent(), agent.set(), and agent.get() flow. Done means the persistent-header behavior is agreed, implemented, documented, and covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100