def check_hash_in_2xx_response(href, effective_url, response, filenames)
      return false if @options[:only_4xx]
      return false unless @options[:check_external_hash]
      return false unless (hash = hash?(href))

      body_doc = create_nokogiri(response.body)

      unencoded_hash = Addressable::URI.unescape(hash)
      xpath = %(//*[@name="#{hash}"]|/*[@name="#{unencoded_hash}"]|//*[@id="#{hash}"]|//*[@id="#{unencoded_hash}"])
      # user-content is a special addition by GitHub.
      if URI.parse(href).host =~ /github\.com/i
        xpath << %(|//*[@name="user-content-#{hash}"]|//*[@id="user-content-#{hash}"])
        # when linking to a file on GitHub, like #L12-L34, only the first "L" portion
        # will be identified as a linkable portion
        if hash =~ /\A(L\d)+/
          xpath << %(|//td[@id="#{Regexp.last_match[1]}"])
        end
      end

      return unless body_doc.xpath(xpath).empty?

      msg = "External link #{href} failed: #{effective_url} exists, but the hash '#{hash}' does not"
      add_external_issue(filenames, msg, response.code)
      @cache.add(href, filenames, response.code, msg)
      true
    end
def check_hash_in_2xx_response(href, effective_url, response, filenames)
      return false if @options[:only_4xx]
      return false unless @options[:check_external_hash]
      return false unless (hash = hash?(href))

      body_doc = create_nokogiri(response.body)

      unencoded_hash = Addressable::URI.unescape(hash)
      xpath = %(//*[@name="#{hash}"]|/*[@name="#{unencoded_hash}"]|//*[@id="#{hash}"]|//*[@id="#{unencoded_hash}"])
      # user-content is a special addition by GitHub.
      if URI.parse(href).host =~ /github\.com/i
        xpath << %(|//*[@name="user-content-#{hash}"]|//*[@id="user-content-#{hash}"])
        # when linking to a file on GitHub, like #L12-L34, only the first "L" portion
        # will be identified as a linkable portion
        if hash =~ /\A(L\d)+/
          xpath << %(|//td[@id="#{Regexp.last_match[1]}"])
        end
      end

      return unless body_doc.xpath(xpath).empty?

      msg = "External link #{href} failed: #{effective_url} exists, but the hash '#{hash}' does not"
      add_external_issue(filenames, msg, response.code)
      @cache.add(href, filenames, response.code, msg)
      true
    end
Even though the response was a success, we may have been asked to check
 if the hash on the URL exists on the page