Skip to content
This repository was archived by the owner on Oct 20, 2025. It is now read-only.

Commit 600925b

Browse files
committed
Fixed BC
1 parent ea26570 commit 600925b

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

lib/Components/Form.vue

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ export default {
140140
default: 0
141141
},
142142
143+
acceptHeader: {
144+
type: String,
145+
required: false,
146+
default: "application/json",
147+
},
148+
143149
headers: {
144150
type: Object,
145151
required: false,
@@ -457,7 +463,13 @@ export default {
457463
? this.values
458464
: objectToFormData(this.values);
459465
460-
const headers = { ...this.headers };
466+
467+
468+
const headers = {};
469+
470+
if(this.acceptHeader) {
471+
headers.Accept = this.acceptHeader;
472+
}
461473
462474
if(this.stay || forceStay) {
463475
headers["X-Splade-Prevent-Refresh"] = true;
@@ -497,7 +509,7 @@ export default {
497509
return successCallback(Object.fromEntries(data));
498510
}
499511
500-
Splade.request(this.action, method, data, headers)
512+
Splade.request(this.action, method, data, { headers, ...this.headers })
501513
.then(successCallback)
502514
.catch(async (error) => {
503515
this.processing = false;

resources/views/functional/form.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
:preserve-scroll="@js($preserveScroll)"
1010
:background="@js($background)"
1111
:debounce="@js($debounce)"
12+
:accept-header="@js($acceptHeader)"
1213
>
1314
<template #default="{!! $scope !!}">
1415
<form data-splade-id="{{ $spladeId }}" v-bind="form.$attrs" @submit.prevent="form.submit" {{ $attributes->only(['action', 'method'])->merge(['method' => 'POST']) }}>

src/Components/Form.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public function __construct(
5353
public bool $preserveScroll = false,
5454
public bool $background = false,
5555
public int $debounce = 0,
56+
public string $acceptHeader = 'text/html, application/xhtml+xml',
5657
) {
5758
// We'll use this instance in the static 'selected()' method,
5859
// which is a workaround for a Vue bug. Later, when the

0 commit comments

Comments
 (0)