The viewer now checks what kind of file was requested and responds with the right kind of response