bxo 0.0.5-dev.62 → 0.0.5-dev.63
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/package.json
CHANGED
|
@@ -127,7 +127,10 @@ export function processResponse(
|
|
|
127
127
|
const headers = mergeHeadersWithCookies(responseHeaders, internalCookies);
|
|
128
128
|
|
|
129
129
|
if (typeof response === 'string') {
|
|
130
|
-
|
|
130
|
+
// Only set Content-Type to text/plain if not already set
|
|
131
|
+
if (!headers.has('Content-Type')) {
|
|
132
|
+
headers.set('Content-Type', 'text/plain');
|
|
133
|
+
}
|
|
131
134
|
return new Response(response, {
|
|
132
135
|
status: ctx.set.status || 200,
|
|
133
136
|
headers: headers
|
|
@@ -182,12 +185,20 @@ export function processResponse(
|
|
|
182
185
|
};
|
|
183
186
|
|
|
184
187
|
if (typeof response === 'string') {
|
|
188
|
+
const finalHeaders: Record<string, string> = {};
|
|
189
|
+
// Copy existing headers if they exist
|
|
190
|
+
if (responseInit.headers) {
|
|
191
|
+
if (typeof responseInit.headers === 'object' && !Array.isArray(responseInit.headers)) {
|
|
192
|
+
Object.assign(finalHeaders, responseInit.headers);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// Only set Content-Type to text/plain if not already set
|
|
196
|
+
if (!finalHeaders['Content-Type']) {
|
|
197
|
+
finalHeaders['Content-Type'] = 'text/plain';
|
|
198
|
+
}
|
|
185
199
|
return new Response(response, {
|
|
186
200
|
...responseInit,
|
|
187
|
-
headers:
|
|
188
|
-
'Content-Type': 'text/plain',
|
|
189
|
-
...responseInit.headers
|
|
190
|
-
}
|
|
201
|
+
headers: finalHeaders
|
|
191
202
|
});
|
|
192
203
|
}
|
|
193
204
|
|