work in progress: image serving
This commit is contained in:
@@ -18,8 +18,10 @@ import (
|
||||
|
||||
type AmContext interface {
|
||||
RC() int
|
||||
OutputType() string
|
||||
Render(string) error
|
||||
SubRender(string) ([]byte, error)
|
||||
SetOutputType(string)
|
||||
SetRC(int)
|
||||
URLPath() string
|
||||
VarMap() jet.VarMap
|
||||
@@ -29,12 +31,17 @@ type amContext struct {
|
||||
echoContext echo.Context
|
||||
httprc int
|
||||
rendervars jet.VarMap
|
||||
outputType string
|
||||
}
|
||||
|
||||
func (c *amContext) RC() int {
|
||||
return c.httprc
|
||||
}
|
||||
|
||||
func (c *amContext) OutputType() string {
|
||||
return c.outputType
|
||||
}
|
||||
|
||||
func (c *amContext) Render(name string) error {
|
||||
return c.echoContext.Render(c.httprc, name, c)
|
||||
}
|
||||
@@ -49,6 +56,10 @@ func (c *amContext) SubRender(name string) ([]byte, error) {
|
||||
return buf.Bytes(), err
|
||||
}
|
||||
|
||||
func (c *amContext) SetOutputType(typ string) {
|
||||
c.outputType = typ
|
||||
}
|
||||
|
||||
func (c *amContext) SetRC(rc int) {
|
||||
c.httprc = rc
|
||||
}
|
||||
@@ -66,6 +77,7 @@ func NewAmContext(ctxt echo.Context) AmContext {
|
||||
echoContext: ctxt,
|
||||
httprc: http.StatusOK,
|
||||
rendervars: make(jet.VarMap),
|
||||
outputType: "",
|
||||
}
|
||||
ctxt.Set("amsterdam_context", &rc)
|
||||
return &rc
|
||||
|
||||
Reference in New Issue
Block a user