osmium::io::Header header() const {
     return m_reader.header();
 }
    std::string fail_in;

    osmium::io::detail::ParserFactory::instance().register_parser(
        osmium::io::file_format::xml,
        [&](osmium::io::detail::future_string_queue_type& input_queue,
            osmium::io::detail::future_buffer_queue_type& output_queue,
            std::promise<osmium::io::Header>& header_promise,
            osmium::osm_entity_bits::type read_which_entities) {
        return std::unique_ptr<osmium::io::detail::Parser>(new MockParser(input_queue, output_queue, header_promise, read_which_entities, fail_in));
    });

    SECTION("no failure") {
        fail_in = "";
        osmium::io::Reader reader(with_data_dir("t/io/data.osm"));
        auto header = reader.header();
        REQUIRE(reader.read());
        REQUIRE(!reader.read());
        REQUIRE(reader.eof());
        reader.close();
    }

    SECTION("throw in header") {
        fail_in = "header";
        try {
            osmium::io::Reader reader(with_data_dir("t/io/data.osm"));
            reader.header();
        } catch (std::runtime_error& e) {
            REQUIRE(std::string{e.what()} == "error in header");
        }
    }