@Override
    public Optional<URL> handleResponse(Response response) throws RegistryErrorException {
      switch (response.getStatusCode()) {
        case HttpURLConnection.HTTP_CREATED:
          // The BLOB exists in the registry.
          return Optional.empty();

        case HttpURLConnection.HTTP_ACCEPTED:
          return Optional.of(getRedirectLocation(response));

        default:
          throw buildRegistryErrorException(
              "Received unrecognized status code " + response.getStatusCode());
      }
    }
Returns a URL to continue pushing the BLOB to, or {@link Optional#empty()} if the BLOB
already exists on the registry.
jib-core/src/main/java/com/google/cloud/tools/jib/registry/BlobPusher.java