示例#1
0
func timerResponseProcessor(r gofw.Request, w gofw.Response, a gofw.URLArgs) (gofw.Request, gofw.Response, gofw.URLArgs) {
	fmt.Println("ResponseMiddleware-Timer")
	time.Sleep(56 * time.Millisecond)
	fmt.Fprintf(w.RawHttpResponseWriter, "\nPage rendered in: %s", time.Now().Sub(w.Get("timerStart").(time.Time)))

	return r, w, a
}
示例#2
0
func timerRequestProcessor(r gofw.Request, w gofw.Response, a gofw.URLArgs) (gofw.Request, gofw.Response, gofw.URLArgs) {
	fmt.Println("RequestMiddleware-Timer")
	w.Set("timerStart", time.Now())
	return r, w, a
}
示例#3
0
func serverHeaderRequestProcessor(r gofw.Request, w gofw.Response, a gofw.URLArgs) (gofw.Request, gofw.Response, gofw.URLArgs) {
	fmt.Println("RequestMiddleware")
	w.SetHeader("Server", "Smile :)")
	return r, w, a
}