instanceof false on null
removed duplication of code around metadata parsing, corrected problems relating to String.toLowercase
mock tests shouldn't repeat other tests; backfilled test that shows code works when intermediary stupidly lowercases metadata headers