func (this *HoverflyUsageHandler) Get(w http.ResponseWriter, req *http.Request, next http.HandlerFunc) {
	var metricsView UsageView
	metricsView.Usage = this.Hoverfly.GetStats()

	bytes, _ := json.Marshal(metricsView)

	handlers.WriteResponse(w, bytes)
}
func (this *HoverflyMiddlewareHandler) Get(w http.ResponseWriter, req *http.Request, next http.HandlerFunc) {
	var middlewareView MiddlewareView
	middlewareView.Middleware = this.Hoverfly.GetMiddleware()

	middlewareBytes, _ := json.Marshal(middlewareView)

	handlers.WriteResponse(w, middlewareBytes)
}
func (this *HoverflyModeHandler) Get(w http.ResponseWriter, req *http.Request, next http.HandlerFunc) {
	var modeView ModeView
	modeView.Mode = this.Hoverfly.GetMode()

	bytes, _ := json.Marshal(modeView)

	handlers.WriteResponse(w, bytes)
}
func (this *HoverflyDestinationHandler) Get(w http.ResponseWriter, req *http.Request, next http.HandlerFunc) {
	var destinationView DestinationView
	destinationView.Destination = this.Hoverfly.GetDestination()

	bytes, _ := json.Marshal(destinationView)

	handlers.WriteResponse(w, bytes)
}
示例#5
0
func (this *SimulationHandler) Get(w http.ResponseWriter, req *http.Request, next http.HandlerFunc) {
	simulationView, err := this.Hoverfly.GetSimulation()
	if err != nil {
		handlers.WriteErrorResponse(w, err.Error(), http.StatusInternalServerError)
		return
	}

	bytes, _ := json.Marshal(simulationView)

	handlers.WriteResponse(w, bytes)
}
示例#6
0
func (this *HoverflyHandler) Get(w http.ResponseWriter, req *http.Request, next http.HandlerFunc) {
	var hoverflyView HoverflyView

	hoverflyView.Destination = this.Hoverfly.GetDestination()
	hoverflyView.Mode = this.Hoverfly.GetMode()
	hoverflyView.Middleware = this.Hoverfly.GetMiddleware()
	hoverflyView.Usage = this.Hoverfly.GetStats()

	bytes, _ := json.Marshal(hoverflyView)

	handlers.WriteResponse(w, bytes)
}