Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to send in own encoder function as part of options object #1612

Closed
wants to merge 1 commit into from

Conversation

willeeklund
Copy link

@willeeklund willeeklund commented Dec 8, 2020

The library does not support sending in your own encoder function as argument to .auth() (encoder is hard coded there).
This PR makes it an optional option.
Without this PR one needs to use the internal ._auth() method, which is bad practise.

.auth(): https://github.com/visionmedia/superagent/blob/master/src/client.js
Screenshot 2020-12-08 at 12 22 46

._auth(): https://github.com/visionmedia/superagent/blob/1277a880c32191e300b229e352e0633e421046c8/src/request-base.js#L514
Screenshot 2020-12-08 at 12 21 05

Copy link
Collaborator

@niftylettuce niftylettuce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think instead you should do const encoder = options.encoder || (string) => { ... rather than overwrite options.encoder.

@titanism
Copy link
Collaborator

see #1720

@titanism titanism closed this Apr 26, 2022
@titanism
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants