<commit_before>// Copyright 2016 <NAME>. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

package goserv

type ErrorHandler interface {
	ServeHTTP(ResponseWriter, *Request, error)
}

type ErrorHandlerFunc func(ResponseWriter, *Request, error)

func (e ErrorHandlerFunc) ServeHTTP(res ResponseWriter, req *Request, err error) {
	e(res, req, err)
}

type Handler interface {
	ServeHTTP(ResponseWriter, *Request)
}

type HandlerFunc func(ResponseWriter, *Request)

func (h HandlerFunc) ServeHTTP(res ResponseWriter, req *Request) {
	h(res, req)
}

type ParamHandler interface {
	ServeHTTP(ResponseWriter, *Request, string)
}

type ParamHandlerFunc func(ResponseWriter, *Request, string)

func (p ParamHandlerFunc) ServeHTTP(res ResponseWriter, req *Request, value string) {
	p(res, req, value)
}
<commit_msg>Document handlers<commit_after>// Copyright 2016 <NAME>. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

package goserv

// A ErrorHandler is the last handler in the request chain and
// is responsible for handling errors that occur during the
// request processing.
//
// A ErrorHandler should always write a response!
type ErrorHandler interface {
	ServeHTTP(ResponseWriter, *Request, error)
}

// ErrorHandlerFunc is an adapter to allow ordinary functions
// to be ErrorHandlers.
type ErrorHandlerFunc func(ResponseWriter, *Request, error)

// ServeHTTP calls the actual function.
func (e ErrorHandlerFunc) ServeHTTP(res ResponseWriter, req *Request, err error) {
	e(res, req, err)
}

// A Handler processes an HTTP request and may respond to it.
type Handler interface {
	ServeHTTP(ResponseWriter, *Request)
}

// HandlerFunc is an adapter to allow ordinary functions to be Handlers.
type HandlerFunc func(ResponseWriter, *Request)

// ServeHTTP calls the actual Handler function.
func (h HandlerFunc) ServeHTTP(res ResponseWriter, req *Request) {
	h(res, req)
}

// A ParamHandler can be registered to a Router using the parameter's name.
// It gets invoked with the corresponding value extracted from the request's
// path.
//
// Parameters are part of a Route's path. To learn more about parameters take
// a look at the documentation of Route.
type ParamHandler interface {
	ServeHTTP(ResponseWriter, *Request, string)
}

// ParamHandlerFunc is an adapter to allow ordinary functions to be ParamHandlers.
type ParamHandlerFunc func(ResponseWriter, *Request, string)

// ServeHTTP calls the actual function.
func (p ParamHandlerFunc) ServeHTTP(res ResponseWriter, req *Request, value string) {
	p(res, req, value)
}

{'fraction_non_alphanumeric': 0.08423406634364518, 'fraction_numerical': 0.002981736861721953, 'mean_word_length': 4.735042735042735, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6106927', 'n_tokens_mistral': 764, 'n_tokens_neox': 742, 'n_words': 318}