Skip to content

Commit 3b65275

Browse files
committed
bug #1903 [LiveComponent] accept live component Content-Type with suffix (WebMamba)
This PR was merged into the 2.x branch. Discussion ---------- [LiveComponent] accept live component Content-Type with suffix | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Issues | Fix #1902 | License | MIT Commits ------- 044f338 [LiveComponent] accept live component Content-Type with suffix
2 parents fc8de45 + 044f338 commit 3b65275

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/LiveComponent/assets/dist/live_controller.js

+2-1
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

+1-1
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)