implement retry for doPost in case of a 502 status code