summaryrefslogtreecommitdiff
path: root/cli/js/web/form_data.ts
diff options
context:
space:
mode:
authorcrowlKats <crowlkats@gmail.com>2020-03-17 07:32:43 +0100
committerGitHub <noreply@github.com>2020-03-17 02:32:43 -0400
commit9833975ef21afced84c6a16724ce13d026f09298 (patch)
tree1a9d76a9bd12c70d362d6feafc37515c66c446c0 /cli/js/web/form_data.ts
parentf9557a4ff6b73a4af37e713bb6b2294253c7b230 (diff)
feat: fetch should accept a FormData body (#4363)
Diffstat (limited to 'cli/js/web/form_data.ts')
-rw-r--r--cli/js/web/form_data.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/cli/js/web/form_data.ts b/cli/js/web/form_data.ts
index 2c70d416f..f60a146d9 100644
--- a/cli/js/web/form_data.ts
+++ b/cli/js/web/form_data.ts
@@ -16,7 +16,9 @@ class FormDataBase {
requiredArguments("FormData.append", arguments.length, 2);
name = String(name);
if (value instanceof blob.DenoBlob) {
- const dfile = new domFile.DomFileImpl([value], filename || name);
+ const dfile = new domFile.DomFileImpl([value], filename || name, {
+ type: value.type
+ });
this[dataSymbol].push([name, dfile]);
} else {
this[dataSymbol].push([name, String(value)]);
@@ -81,7 +83,9 @@ class FormDataBase {
if (this[dataSymbol][i][0] === name) {
if (!found) {
if (value instanceof blob.DenoBlob) {
- const dfile = new domFile.DomFileImpl([value], filename || name);
+ const dfile = new domFile.DomFileImpl([value], filename || name, {
+ type: value.type
+ });
this[dataSymbol][i][1] = dfile;
} else {
this[dataSymbol][i][1] = String(value);
@@ -98,7 +102,9 @@ class FormDataBase {
// Otherwise, append entry to the context object’s entry list.
if (!found) {
if (value instanceof blob.DenoBlob) {
- const dfile = new domFile.DomFileImpl([value], filename || name);
+ const dfile = new domFile.DomFileImpl([value], filename || name, {
+ type: value.type
+ });
this[dataSymbol].push([name, dfile]);
} else {
this[dataSymbol].push([name, String(value)]);