NAME

Sentry::Web::RequestData - Internal: the request data of events

SYNOPSIS

package Sentry::Web::RequestData::Foo;
use Sentry::Base 'Sentry::Web::RequestData';

has 'req';

sub method ($self) { $self->req->method }
sub url ($self)    { $self->req->url_without_query }

# In the request's isolation scope
Sentry::Scope->get_isolation_scope->request(
  Sentry::Web::Request->new(data => Sentry::Web::RequestData::Foo->new(req => $req)));

DESCRIPTION

Internal. Turns a request of a web framework or server into the request of Sentry events, scrubbed by Sentry::DataScrubber. Subclasses read the request (method, url, query_params, headers, cookies, body, env); this class scrubs the data and collects it only when an event needs it.

Errors get all of it, transactions only method, URL, query string and a few headers (see "full, reduced").

METHODS

for_event

my $request = $data->for_event($event);

normalized_headers

The headers named as in HTTP (User-Agent); names differing in case only become one list, in the order of the names.

request_id

The value of the X-Request-ID header, if any.

cgi_headers

my $headers = $class->cgi_headers(\%ENV);

For subclasses: the headers of a CGI environment (HTTP_*, CONTENT_TYPE, CONTENT_LENGTH), named as in HTTP (User-Agent).

parse_query, parse_cookies

my $params  = $class->parse_query('a=1&a=2&b=%20');
my $cookies = $class->parse_cookies('a=1; b=2');

For subclasses: hashes of a query string or Cookie header, repeated names as lists.

full, reduced

The request data, collected once. {} if collecting it failed.