Checking the response status for 400 and throwing exception. Unit tests updated. Fixes #37406
str.format()