Some headers appear twice, once in lowercase and once in mixed-case, because some data structures provide them in lowercase, others in mixed-case, and the header-merging algorithm will include both the mixed-case and lowercase.
I discovered this issue while experimenting with porting/re-writing chrome-har in typescript and trying to replicate chrome-har's current behavior. Please feel free to compare against the typescript implementation to test the fix, or to adopt the code from it, which is also MIT license. (You're free to take the whole thing, but it's a very big change of coding style to adapt to if you don't like typescript.) Sorry that the first you are hearing from me is me filing bugs, but leaving them unreported seemed worse than the alternative.