react-router
react-router copied to clipboard
fix responseStub
API is cumbersome, I'm thinking this:
function loader({ response }) {
// change status
response.status(404)
// append/set headers
response.headers.append('Cookie', 'foo=bar')
response.headers.set('X-Foo', 'bar')
// redirect (throws)
response.redirect('/login')
response.redirect(`/post/${newPostId}`, 303)
// redirect with status and SET headers
response.headers.set('Cookie', clearedCookie())
response.redirect('/login', 303)
// raise (throw) data and status to the error boundary
response.raise('Not Found', 404)
}