Skip to content

Commit 7d607e6

Browse files
authored
fix(multipart): let FormData set Content-Type boundary, not us (shocker) (#357)
* fix(multipart): let FormData set Content-Type boundary, not us (shocker) - Remove manual multipart Content-Type header; let FormData set boundary - Fixes broken uploads in browser and Node; Authorization header unchanged Signed-off-by: Jessie Frazelle <[email protected]> * chore(release): bump @kittycad/lib to 3.0.2, try not to blink - Patch bump only, no API changes Signed-off-by: Jessie Frazelle <[email protected]> --------- Signed-off-by: Jessie Frazelle <[email protected]>
1 parent 426c471 commit 7d607e6

File tree

7 files changed

+7
-19
lines changed

7 files changed

+7
-19
lines changed

gen/templates/multipart.hbs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ export default async function {{functionName}}(
3030
process.env.KITTYCAD_API_TOKEN ||
3131
process.env.ZOO_API_TOKEN ||
3232
'';
33-
const headers: Record<string, string> = {
34-
'Content-Type': 'multipart/form-data',
35-
};
33+
const headers: Record<string, string> = {};
3634
if (kittycadToken) headers.Authorization = `Bearer ${kittycadToken}`;
3735

3836
const formData = new FormData();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@kittycad/lib",
3-
"version": "3.0.1",
3+
"version": "3.0.2",
44
"description": "Javascript library for KittyCAD API",
55
"type": "module",
66
"keywords": [

src/api/file/create_file_conversion_options.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ export default async function create_file_conversion_options({
5858
process.env.KITTYCAD_API_TOKEN ||
5959
process.env.ZOO_API_TOKEN ||
6060
''
61-
const headers: Record<string, string> = {
62-
'Content-Type': 'multipart/form-data',
63-
}
61+
const headers: Record<string, string> = {}
6462
if (kittycadToken) headers.Authorization = `Bearer ${kittycadToken}`
6563

6664
const formData = new FormData()

src/api/meta/create_debug_uploads.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ export default async function create_debug_uploads({
4949
process.env.KITTYCAD_API_TOKEN ||
5050
process.env.ZOO_API_TOKEN ||
5151
''
52-
const headers: Record<string, string> = {
53-
'Content-Type': 'multipart/form-data',
54-
}
52+
const headers: Record<string, string> = {}
5553
if (kittycadToken) headers.Authorization = `Bearer ${kittycadToken}`
5654

5755
const formData = new FormData()

src/api/meta/create_event.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ export default async function create_event({
5252
process.env.KITTYCAD_API_TOKEN ||
5353
process.env.ZOO_API_TOKEN ||
5454
''
55-
const headers: Record<string, string> = {
56-
'Content-Type': 'multipart/form-data',
57-
}
55+
const headers: Record<string, string> = {}
5856
if (kittycadToken) headers.Authorization = `Bearer ${kittycadToken}`
5957

6058
const formData = new FormData()

src/api/ml/create_proprietary_to_kcl.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ export default async function create_proprietary_to_kcl({
5858
process.env.KITTYCAD_API_TOKEN ||
5959
process.env.ZOO_API_TOKEN ||
6060
''
61-
const headers: Record<string, string> = {
62-
'Content-Type': 'multipart/form-data',
63-
}
61+
const headers: Record<string, string> = {}
6462
if (kittycadToken) headers.Authorization = `Bearer ${kittycadToken}`
6563

6664
const formData = new FormData()

src/api/ml/create_text_to_cad_multi_file_iteration.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ export default async function create_text_to_cad_multi_file_iteration({
6565
process.env.KITTYCAD_API_TOKEN ||
6666
process.env.ZOO_API_TOKEN ||
6767
''
68-
const headers: Record<string, string> = {
69-
'Content-Type': 'multipart/form-data',
70-
}
68+
const headers: Record<string, string> = {}
7169
if (kittycadToken) headers.Authorization = `Bearer ${kittycadToken}`
7270

7371
const formData = new FormData()

0 commit comments

Comments
 (0)