コード例 #1
0
ファイル: timerMiddleware.go プロジェクト: arbuckle/gofw
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
ファイル: timerMiddleware.go プロジェクト: arbuckle/gofw
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
}