I am not sure to fully understand what you mean.
oh .. if one swap  `k' and `v' ...
apart from using  specific type such as  HEADER_KEY and HEADER_VALUE ...
I don't see how the compiler could catch such error.

probably we could check for the validity of the `k' string ... no whitespace, no comma, and so on ...
that would be a first verification.