diff --git a/sentry-ruby/spec/sentry/excon_spec.rb b/sentry-ruby/spec/sentry/excon_spec.rb index a0aa67e64..bca0463a7 100644 --- a/sentry-ruby/spec/sentry/excon_spec.rb +++ b/sentry-ruby/spec/sentry/excon_spec.rb @@ -89,6 +89,34 @@ }) end + it "records the request's span with advanced query string in data" do + Excon.stub({}, { body: '', status: 200 }) + + transaction = Sentry.start_transaction + Sentry.get_current_scope.set_span(transaction) + + connection = Excon.new('http://example.com/path') + response = connection.get(mock: true, query: { foo: 'bar', baz: [1, 2], qux: { a: 1, b: 2 } }) + + expect(response.status).to eq(200) + expect(transaction.span_recorder.spans.count).to eq(2) + + request_span = transaction.span_recorder.spans.last + expect(request_span.op).to eq("http.client") + expect(request_span.origin).to eq("auto.http.excon") + expect(request_span.start_timestamp).not_to be_nil + expect(request_span.timestamp).not_to be_nil + expect(request_span.start_timestamp).not_to eq(request_span.timestamp) + expect(request_span.description).to eq("GET http://example.com/path") + expect(request_span.data).to eq({ + "http.response.status_code" => 200, + "url" => "http://example.com/path", + "http.request.method" => "GET", + # This equals: "foo=bar&baz[]=1&baz[]=2&qux[a]=1&qux[b]=2" + "http.query" => "foo=bar&baz%5B%5D=1&baz%5B%5D=2&qux%5Ba%5D=1&qux%5Bb%5D=2" + }) + end + it "records breadcrumbs" do Excon.stub({}, { body: '', status: 200 })