handle_redirect

in lib/crawler/http_executor.rb [179:200]


    def handle_redirect(crawl_task:, response:, result_args:)
      redirect_location = response.redirect_location
      if redirect_location
        return Crawler::Data::CrawlResult::Redirect.new(
          **result_args.merge(
            location: redirect_location,
            redirect_chain: crawl_task.redirect_chain
          )
        )
      end
      
      error = <<~LOG.squish
        Redirect from 
        redirect location. The response code from this URL was 
      LOG
      logger.warn(error)
      Crawler::Data::CrawlResult::RedirectError.new(
        url: crawl_task.url,
        error:
      )
    end