Module: ZendeskAppsSupport::Validations::Requests

Defined in:
lib/zendesk_apps_support/validations/requests.rb

Class Method Summary collapse

Class Method Details

.call(package) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/zendesk_apps_support/validations/requests.rb', line 10

def call(package)
  files = package.js_files + package.html_files

  files.each do |file|
    file_content = file.read

    http_protocol_urls = find_address_containing_http(file_content)
    next unless http_protocol_urls.any?
    package.warnings << insecure_http_requests_warning(
      http_protocol_urls,
      file.relative_path
    )
  end

  package.warnings.flatten!
end