Closed egil closed 2 months ago
HtmxResponse line 145:
public HtmxResponse Reswap(string modifier)
{
if (string.IsNullOrWhiteSpace(modifier))
{
headers.Remove(HtmxResponseHeaderNames.Reswap);
}
else
{
headers[HtmxResponseHeaderNames.Reswap] = modifier;
}
return this;
}
The remove aspect for headers is an undocumented side effect which I'm fine with adding but just augment the xmldoc. Also, on line 171 you call Reswap(modifier) in which modifier is nullable even though the parameter of that Reswap overload isn't nullable. Perhaps use either Reswap(modifier ?? string.Empty) or throw an exception. Being honest, I'm thinking if you call reswap with a SwapStyle.Default and no modifier then it's purely a mistake that would have no effect and might be worth alerting the developer via the thrown exception.
Also is AjaxContext impacted by this at all with the Swap property?
Good point. Ill throw an argument null exception if modifier is null or whitespace.
As for AjaxContent, lets cover that in another PR.
These were the changes I was thinking about for your PR. See any issues with them @tanczosm?