diff --git a/app/models/notice.rb b/app/models/notice.rb index 644084e25..660dfc49f 100644 --- a/app/models/notice.rb +++ b/app/models/notice.rb @@ -87,17 +87,6 @@ def host "N/A" end - def to_curl - return "N/A" if url.blank? - headers = %w(Accept Accept-Encoding Accept-Language Cookie Referer User-Agent).each_with_object([]) do |name, h| - if (value = env_vars["HTTP_#{name.underscore.upcase}"]) - h << "-H '#{name}: #{value}'" - end - end - - "curl -X #{env_vars['REQUEST_METHOD'] || 'GET'} #{headers.join(' ')} #{url}" - end - def env_vars vars = request['cgi-data'] vars.is_a?(Hash) ? vars : {} diff --git a/app/views/notices/_summary.html.haml b/app/views/notices/_summary.html.haml index 5735d7a11..c40d5cd1c 100644 --- a/app/views/notices/_summary.html.haml +++ b/app/views/notices/_summary.html.haml @@ -10,9 +10,6 @@ %tr %th= t('.url') %td.nowrap= link_to notice.request['url'], notice.request['url'] - %tr - %th   - %td= notice.to_curl %tr %th= t('.where') %td= notice.where diff --git a/spec/models/notice_spec.rb b/spec/models/notice_spec.rb index 0c938f546..a4c3a61ca 100644 --- a/spec/models/notice_spec.rb +++ b/spec/models/notice_spec.rb @@ -65,28 +65,6 @@ end end - describe "to_curl" do - let(:notice) { Fabricate.build(:notice, request: request) } - - context "when it has a request url" do - let(:request) { { 'url' => "http://example.com/resource/12", 'cgi-data' => { 'HTTP_USER_AGENT' => 'Mozilla/5.0' } } } - - it 'has a curl representation' do - cmd = notice.to_curl - expect(cmd).to eq("curl -X GET -H 'User-Agent: Mozilla/5.0' http://example.com/resource/12") - end - end - - context "when it has not a request url" do - let(:request) { { 'cgi-data' => { 'HTTP_USER_AGENT' => 'Mozilla/5.0' } } } - - it 'has a curl representation' do - cmd = notice.to_curl - expect(cmd).to eq "N/A" - end - end - end - describe "user agent" do it "should be parsed and human-readable" do notice = Fabricate.build(:notice, request: { 'cgi-data' => {