Value extractor

Extract exact value type from *http.Request or http.ResponseWriter

The main difference between value extractor and string extractor is that the value extractor extracts a value and not exclusively strings. String extractors are then parsed and then converted into the appropriate type, it's not the case for value extractor.

KCD use value extractor for context.

To create a value extractor you need to implement this interface:

type Value interface {
	Extract(req *http.Request, res http.ResponseWriter, valueOfTag string) (interface{}, error)
	Tag() string
}

Same as string extractor to add it you need to add it to kcd.Config.ValueExtractors.

Last updated