Create "responses" that contain headers
/status
without forcing
serialization into an actual Response
import { data } from "react-router";
export async function action({ request }: Route.ActionArgs) {
let formData = await request.formData();
let item = await createItem(formData);
return data(item, {
headers: { "X-Custom-Header": "value" }
status: 201,
});
}
function data<D>(data: D, init?: number | ResponseInit)
The data to be included in the response.
The status code or a ResponseInit
object to be included in the response.
A DataWithResponseInit
instance containing the data and
response init.