do not send content when there is a htmx redirect
This commit is contained in:
@@ -665,11 +665,11 @@ void FunctionBase::redirect_to(const wchar_t * url, bool append_domain)
|
||||
{
|
||||
if( append_domain )
|
||||
{
|
||||
cur->request->out_headers.add(L"HX-Redirect", prepare_doc_url(url));
|
||||
cur->request->out_headers.add(Header::hx_redirect, prepare_doc_url(url));
|
||||
}
|
||||
else
|
||||
{
|
||||
cur->request->out_headers.add(L"HX-Redirect", url);
|
||||
cur->request->out_headers.add(Header::hx_redirect, url);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -702,7 +702,6 @@ void FunctionBase::redirect_to(const pt::WTextStream & url, bool append_domain)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FunctionBase::redirect_to(const wchar_t * url, const wchar_t * frame_url, const wchar_t * dom_target)
|
||||
{
|
||||
if( cur->request->is_htmx_request )
|
||||
@@ -715,7 +714,7 @@ void FunctionBase::redirect_to(const wchar_t * url, const wchar_t * frame_url, c
|
||||
prepare_doc_url(url, full_url);
|
||||
prepare_doc_url(frame_url, full_frame_url);
|
||||
|
||||
pt::Space & trigger = cur->request->out_headers.get_add_space(L"HX-Trigger");
|
||||
pt::Space & trigger = cur->request->out_headers.get_add_space(Header::hx_trigger);
|
||||
pt::Space & redirect = trigger.get_add_space(L"winix:redirect");
|
||||
redirect.add(L"path", full_frame_url);
|
||||
redirect.add(L"target", dom_target);
|
||||
@@ -724,9 +723,11 @@ void FunctionBase::redirect_to(const wchar_t * url, const wchar_t * frame_url, c
|
||||
|
||||
if( can_push_url_to_browser_history() )
|
||||
{
|
||||
cur->request->out_headers.add(L"HX-Push-Url", full_url);
|
||||
cur->request->out_headers.add(Header::hx_push_url, full_url);
|
||||
log << log3 << "FunctionBase: pushing a new url to the browser history: " << full_url << logend;
|
||||
}
|
||||
|
||||
cur->request->out_headers.add(Header::hx_reswap, L"none");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -782,20 +783,20 @@ void FunctionBase::retarged(const wchar_t * frame, const wchar_t * dom_target, c
|
||||
|
||||
if( dom_target && (*dom_target) )
|
||||
{
|
||||
cur->request->out_headers.add(L"HX-Retarget", dom_target);
|
||||
cur->request->out_headers.add(Header::hx_retarget, dom_target);
|
||||
log_msg << ", container: " << dom_target;
|
||||
}
|
||||
|
||||
if( push_url && can_push_url_to_browser_history() )
|
||||
{
|
||||
std::wstring url = prepare_doc_url(push_url);
|
||||
cur->request->out_headers.add(L"HX-Push-Url", url);
|
||||
cur->request->out_headers.add(Header::hx_push_url, url);
|
||||
log << log3 << "FunctionBase: pushing a new url to the browser history: " << url << logend;
|
||||
}
|
||||
|
||||
if( swap_algorithm && (*swap_algorithm) )
|
||||
{
|
||||
cur->request->out_headers.add(L"HX-Reswap", swap_algorithm);
|
||||
cur->request->out_headers.add(Header::hx_reswap, swap_algorithm);
|
||||
}
|
||||
|
||||
log << log3 << "FunctionBase: changing the targed" << log_msg << logend;
|
||||
@@ -819,7 +820,7 @@ void FunctionBase::retarged(const wchar_t * frame, pt::WTextStream & dom_target,
|
||||
|
||||
void FunctionBase::remove_content(pt::WTextStream & dom_target, bool close_dialogs)
|
||||
{
|
||||
pt::Space & trigger = cur->request->out_headers.get_add_space(L"HX-Trigger");
|
||||
pt::Space & trigger = cur->request->out_headers.get_add_space(Header::hx_trigger);
|
||||
pt::Space & remove_content = trigger.get_add_space(L"winix:removecontent");
|
||||
pt::Space & rm = remove_content.get_add_space(L"rm");
|
||||
rm.add(dom_target);
|
||||
@@ -898,7 +899,7 @@ void FunctionBase::update_content(const wchar_t * frame, const wchar_t * dom_tar
|
||||
|
||||
void FunctionBase::close_modal_dialogs()
|
||||
{
|
||||
pt::Space & trigger = cur->request->out_headers.get_add_space(L"HX-Trigger");
|
||||
pt::Space & trigger = cur->request->out_headers.get_add_space(Header::hx_trigger);
|
||||
trigger.add(L"winix:closedialogs", true);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user