do not send content when there is a htmx redirect
This commit is contained in:
@@ -854,9 +854,6 @@ void Request::ModifyStatusForRedirect()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// may rename to something like PrepareAndSendAnswer()?
|
||||
void Request::PrepareAndSendAnswer()
|
||||
{
|
||||
@@ -874,7 +871,7 @@ void Request::PrepareAndSendAnswer()
|
||||
}
|
||||
}
|
||||
|
||||
if( !redirect_to.empty() || !x_sendfile.empty() || method == Request::options )
|
||||
if( method == Request::options || !redirect_to.empty() || !x_sendfile.empty() || has_htmx_redirect() )
|
||||
{
|
||||
Send8bitOutput(output_8bit); // send empty content
|
||||
return;
|
||||
@@ -2259,6 +2256,21 @@ void Request::PutMethodName(pt::Stream & stream)
|
||||
}
|
||||
|
||||
|
||||
bool Request::has_htmx_redirect()
|
||||
{
|
||||
if( out_headers.has_key(Header::hx_redirect) ||
|
||||
out_headers.has_key(Header::hx_location) ||
|
||||
out_headers.has_key(Header::hx_refresh) )
|
||||
return true;
|
||||
|
||||
pt::Space * trigger = out_headers.get_space(Header::hx_trigger);
|
||||
|
||||
if( trigger && trigger->has_key(L"winix:redirect") )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void Request::AddCookie(
|
||||
const std::wstring & name,
|
||||
|
Reference in New Issue
Block a user