routing: extend and improve `respondWithDirectives`