Skip to content

Commit 044f338

Browse files
committed
[LiveComponent] accept live component Content-Type with suffix
1 parent 7a84975 commit 044f338

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/LiveComponent/assets/dist/live_controller.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2049,13 +2049,14 @@ class Component {
20492049
this.valueStore.flushDirtyPropsToPending();
20502050
this.isRequestPending = false;
20512051
this.backendRequest.promise.then(async (response) => {
2052+
var _a;
20522053
const backendResponse = new BackendResponse(response);
20532054
const html = await backendResponse.getBody();
20542055
for (const input of Object.values(this.pendingFiles)) {
20552056
input.value = '';
20562057
}
20572058
const headers = backendResponse.response.headers;
2058-
if (headers.get('Content-Type') !== 'application/vnd.live-component+html' && !headers.get('X-Live-Redirect')) {
2059+
if (!((_a = headers.get('Content-Type')) === null || _a === void 0 ? void 0 : _a.includes('application/vnd.live-component+html')) && !headers.get('X-Live-Redirect')) {
20592060
const controls = { displayError: true };
20602061
this.valueStore.pushPendingPropsBackToDirty();
20612062
this.hooks.triggerHook('response:error', backendResponse, controls);

src/LiveComponent/assets/src/Component/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ export default class Component {
296296

297297
// if the response does not contain a component, render as an error
298298
const headers = backendResponse.response.headers;
299-
if (headers.get('Content-Type') !== 'application/vnd.live-component+html' && !headers.get('X-Live-Redirect')) {
299+
if (!headers.get('Content-Type')?.includes('application/vnd.live-component+html') && !headers.get('X-Live-Redirect')) {
300300
const controls = { displayError: true };
301301
this.valueStore.pushPendingPropsBackToDirty();
302302
this.hooks.triggerHook('response:error', backendResponse, controls);

0 commit comments

Comments
 (0)