Sha256: cd24f91ef74f7a3db0c7d762c9a8e10363f5a85f86aa4e6eddf7c1e20f784552
Contents?: true
Size: 1.01 KB
Versions: 3
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true module Neetob class CLI module Redirections class Check < CLI::Base attr_accessor :sandbox, :source, :destination def initialize(source, destination, sandbox = false) super() @source = source @destination = destination @sandbox = sandbox end def run source_url = URI.parse(source) destination_url = URI.parse(destination) response = Net::HTTP.get_response(source_url) if response.code.in? %w(301 302 308) if response["location"].chomp("/") == destination.chomp("/") ui.success("The redirection from #{source} to #{destination} is working properly.") else ui.error("The redirection from #{source} to #{destination} is not working properly.") end else ui.error("The redirection from #{source} to #{destination} is not working properly.") end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
neetob-0.5.16 | lib/neetob/cli/redirections/check.rb |
neetob-0.5.15 | lib/neetob/cli/redirections/check.rb |
neetob-0.5.14 | lib/neetob/cli/redirections/check.rb |