Module: Datadog::AppSec::APISecurity::EndpointCollection::SinatraRouteSerializer

Defined in:
lib/datadog/appsec/api_security/endpoint_collection/sinatra_route_serializer.rb

Overview

This module serializes Sinatra routes.

Class Method Summary collapse

Class Method Details

.serialize(route, method:, path_prefix: "") ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/datadog/appsec/api_security/endpoint_collection/sinatra_route_serializer.rb', line 9

def self.serialize(route, method:, path_prefix: "")
  path = path_prefix + route.safe_string

  {
    type: "REST",
    resource_name: "#{method} #{path}",
    operation_name: "http.request",
    method: method,
    path: path,
  }
end