Write status code and headers