3 ms·
> I take a similarly strong position for such strong typing. Why not add a weak checking for k-v strings? Something like during compile time: if not k i
by est 13y ago
> I take a similarly strong position for such strong typing.
Why not add a weak checking for k-v strings? Something like during compile time:
if not k in LIST_OF_WELLKNOWNS
warn('Bad header maybe?')
You don't have to use types to check this.
- lmm 13y agoYou don't have to use types, but if you do then the type system guarantees your checks are exhaustive, which is more effective than manually checking you've covered all the paths. I really like the spray way. You can add a custom/nonstandard header by using RawHeader(key, value), but most of the time you use e.g. Headers.ContentType(MediaTypes.`application/json`), and it just completely eliminates a class of trivial but annoying bugs.