Introduced helper methods for parsing/biding request parameters

This commit is contained in:
Deluan
2016-03-07 14:13:01 -05:00
parent 91c660c746
commit 28bef732cf
8 changed files with 28 additions and 20 deletions
+2 -3
View File
@@ -20,7 +20,7 @@ type StreamController struct {
func (c *StreamController) Prepare() {
inject.ExtractAssignable(utils.Graph, &c.repo)
c.id = c.GetParameter("id", "id parameter required")
c.id = c.RequiredParamString("id", "id parameter required")
mf, err := c.repo.Get(c.id)
if err != nil {
@@ -39,8 +39,7 @@ func (c *StreamController) Prepare() {
// TODO Still getting the "Conn.Write wrote more than the declared Content-Length" error.
// Don't know if this causes any issues
func (c *StreamController) Stream() {
var maxBitRate int
c.Ctx.Input.Bind(&maxBitRate, "maxBitRate")
maxBitRate := c.ParamInt("maxBitRate")
maxBitRate = utils.MinInt(c.mf.BitRate, maxBitRate)
beego.Debug("Streaming file", c.id, ":", c.mf.Path)