<commit_before>package web

import (
	"net/http"
	"reflect"
)

type Request struct {
	*http.Request

	// This map exists if you have wildcards in your URL that you need to capture.
	// Eg, /users/:id/tickets/:ticket_id and /users/1/tickets/33 would yield the map {id: "3", ticket_id: "33"}
	PathParams map[string]string

	// The actual route that got invoked
	route *Route

	rootContext   reflect.Value // Root context. Set immediately.
	targetContext reflect.Value // The target context corresponding to the route. Not set until root middleware is done.
}

func (r *Request) IsRouted() bool {
	return r.route != nil
}
func (r *Request) RoutePath() string {
	return r.route.Path
}<commit_msg>BUGFIX: Don't panic if there's no route matched. Instead, return the empty string.<commit_after>package web

import (
	"net/http"
	"reflect"
)

type Request struct {
	*http.Request

	// This map exists if you have wildcards in your URL that you need to capture.
	// Eg, /users/:id/tickets/:ticket_id and /users/1/tickets/33 would yield the map {id: "3", ticket_id: "33"}
	PathParams map[string]string

	// The actual route that got invoked
	route *Route

	rootContext   reflect.Value // Root context. Set immediately.
	targetContext reflect.Value // The target context corresponding to the route. Not set until root middleware is done.
}

func (r *Request) IsRouted() bool {
	return r.route != nil
}

func (r *Request) RoutePath() string {
	if r.route != nil {
		return r.route.Path
	}
	return ""
}
{'fraction_non_alphanumeric': 0.10671140939597315, 'fraction_numerical': 0.008053691275167786, 'mean_word_length': 3.6448598130841123, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1239275', 'n_tokens_mistral': 481, 'n_tokens_neox': 467, 'n_words': 182}