create-brainerce-store 1.29.1 → 1.29.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var require_package = __commonJS({
|
|
|
31
31
|
"package.json"(exports2, module2) {
|
|
32
32
|
module2.exports = {
|
|
33
33
|
name: "create-brainerce-store",
|
|
34
|
-
version: "1.29.
|
|
34
|
+
version: "1.29.13",
|
|
35
35
|
description: "Scaffold a production-ready e-commerce storefront connected to Brainerce",
|
|
36
36
|
bin: {
|
|
37
37
|
"create-brainerce-store": "dist/index.js"
|
package/package.json
CHANGED
|
@@ -85,9 +85,13 @@ async function proxyRequest(
|
|
|
85
85
|
backendUrl.searchParams.set(key, value);
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
-
// Build headers for backend request
|
|
88
|
+
// Build headers for backend request. Preserve the incoming Content-Type
|
|
89
|
+
// (including the multipart boundary for file uploads); default to JSON
|
|
90
|
+
// when absent. Overriding the Content-Type would strip the boundary and
|
|
91
|
+
// corrupt multipart uploads on the backend.
|
|
92
|
+
const incomingContentType = request.headers.get('content-type');
|
|
89
93
|
const headers: Record<string, string> = {
|
|
90
|
-
'Content-Type': 'application/json',
|
|
94
|
+
'Content-Type': incomingContentType || 'application/json',
|
|
91
95
|
};
|
|
92
96
|
|
|
93
97
|
// Send the proxy's own origin (not the client-supplied Origin header).
|
|
@@ -114,11 +118,14 @@ async function proxyRequest(
|
|
|
114
118
|
headers['Authorization'] = `Bearer ${tokenCookie.value}`;
|
|
115
119
|
}
|
|
116
120
|
|
|
117
|
-
// Forward request body for non-GET requests
|
|
118
|
-
|
|
121
|
+
// Forward request body for non-GET requests. Use ArrayBuffer so multipart
|
|
122
|
+
// bodies (file uploads) pass through unchanged — `request.text()` works for
|
|
123
|
+
// JSON but would break binary content.
|
|
124
|
+
const isMultipart = incomingContentType?.includes('multipart/form-data') ?? false;
|
|
125
|
+
let body: ArrayBuffer | string | undefined;
|
|
119
126
|
if (method !== 'GET' && method !== 'HEAD') {
|
|
120
127
|
try {
|
|
121
|
-
body = await request.text();
|
|
128
|
+
body = isMultipart ? await request.arrayBuffer() : await request.text();
|
|
122
129
|
} catch {
|
|
123
130
|
// No body
|
|
124
131
|
}
|
|
@@ -340,10 +340,10 @@ function SingleImageField({
|
|
|
340
340
|
className="text-foreground text-sm"
|
|
341
341
|
/>
|
|
342
342
|
{uploading && (
|
|
343
|
-
<
|
|
343
|
+
<span className="text-muted-foreground mt-2 inline-flex items-center gap-2 text-xs">
|
|
344
344
|
<LoadingSpinner size="sm" />
|
|
345
345
|
{t('uploading')}
|
|
346
|
-
</
|
|
346
|
+
</span>
|
|
347
347
|
)}
|
|
348
348
|
{value && !uploading && (
|
|
349
349
|
<div className="mt-2">
|
|
@@ -406,10 +406,10 @@ function GalleryField({
|
|
|
406
406
|
className="text-foreground text-sm"
|
|
407
407
|
/>
|
|
408
408
|
{uploading && (
|
|
409
|
-
<
|
|
409
|
+
<span className="text-muted-foreground mt-2 inline-flex items-center gap-2 text-xs">
|
|
410
410
|
<LoadingSpinner size="sm" />
|
|
411
411
|
{t('uploading')}
|
|
412
|
-
</
|
|
412
|
+
</span>
|
|
413
413
|
)}
|
|
414
414
|
{value.length > 0 && (
|
|
415
415
|
<div className="mt-2 flex flex-wrap gap-2">
|