示例#1
0
func (p *LoginAccountRequestHandler) ContentTypesProvided(req wm.Request, cxt wm.Context) ([]wm.MediaTypeHandler, wm.Request, wm.Context, int, error) {
	genFunc := func() (jsonhelper.JSONObject, time.Time, string, int, http.Header) {
		lac := cxt.(LoginAccountContext)
		jsonObj := lac.Result()
		headers := apiutil.AddNoCacheHeaders(nil)
		return jsonObj, time.Time{}, "", http.StatusOK, headers
	}
	return []wm.MediaTypeHandler{apiutil.NewJSONMediaTypeHandlerWithGenerator(genFunc, time.Time{}, "")}, req, cxt, 0, nil
}
示例#2
0
文件: view.go 项目: pomack/dsocial.go
func (p *ViewContactRequestHandler) ContentTypesProvided(req wm.Request, cxt wm.Context) ([]wm.MediaTypeHandler, wm.Request, wm.Context, int, error) {
	genFunc := func() (jsonhelper.JSONObject, time.Time, string, int, http.Header) {
		vcc := cxt.(ViewContactContext)
		jsonObj := vcc.Result()
		headers := apiutil.AddNoCacheHeaders(nil)
		return jsonObj, vcc.LastModified(), vcc.ETag(), http.StatusOK, headers
	}
	return []wm.MediaTypeHandler{apiutil.NewJSONMediaTypeHandlerWithGenerator(genFunc, time.Time{}, "")}, req, cxt, 0, nil
}