MCPcopy Create free account
hub / github.com/cloudflare/cloudflared / ConfigurationHandler

Method ConfigurationHandler

diagnostic/handlers.go:120–135  ·  view source on GitHub ↗
(writer http.ResponseWriter, _ *http.Request)

Source from the content-addressed store, hash-verified

118}
119
120func (handler *Handler) ConfigurationHandler(writer http.ResponseWriter, _ *http.Request) {
121 log := handler.log.With().Str(collectorField, configurationCollectorName).Logger()
122 log.Info().Msg("Collection started")
123
124 defer func() {
125 log.Info().Msg("Collection finished")
126 }()
127
128 encoder := json.NewEncoder(writer)
129
130 err := encoder.Encode(handler.cliFlags)
131 if err != nil {
132 handler.log.Error().Err(err).Msgf("error occurred whilst serializing response")
133 writer.WriteHeader(http.StatusInternalServerError)
134 }
135}
136
137func writeResponse(w http.ResponseWriter, bytes []byte, logger *zerolog.Logger) {
138 bytesWritten, err := w.Write(bytes)

Callers 1

TestConfigurationHandlerFunction · 0.80

Implementers 1

JWTValidatoringress/middleware/jwtvalidator.go

Calls 5

EncodeMethod · 0.95
LoggerMethod · 0.80
ErrMethod · 0.45
ErrorMethod · 0.45
WriteHeaderMethod · 0.45

Tested by 1

TestConfigurationHandlerFunction · 0.64