Refactor adding optional headers to image request