forwardemail / forwardemail/superagent

Adding an options argument to .field function to enable setting binary option in form-data

Open
#1,626 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

In the function (file request-base.js)
RequestBase.prototype.field = function (name, value) {
.....
this._getFormData().append(name, value);
return this;
};

Actually Form data class has function to do append(name, value, options), which allow to add binary data, e.g. 'blob'.
So if you could change the function to be:
RequestBase.prototype.field = function (name, value, options) { // add options argument
.....
this._getFormData().append(name, value, options); // simply pass the options to form-data
return this;
};

Users could add binary data easily. I've tried locally and works fine.

Contributor guide

Open the contributing guide

Research direction

Read request-base.js and the existing RequestBase.prototype.field implementation first. Check the surrounding request and form-data tests, then verify that an options argument reaches form-data append and supports binary data without changing existing calls.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
56/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.