Replace each with inject.
Extract JSON parsing method.
Fallback to GET on all errors.

Some sites don't respond to HEAD requests at all, which gives false negatives.