Merge pull request #143 from joshdekock/middleware-refactor-request-fix

http: stopped throwing error on invalid event
This commit is contained in:
Jimmy Zelinskie 2016-03-31 10:11:19 -04:00
commit e9c481e500
2 changed files with 4 additions and 1 deletions

View file

@ -1,5 +1,6 @@
# This is the official list of Chihaya contributors, in alphabetical order. # This is the official list of Chihaya contributors, in alphabetical order.
Jimmy Zelinskie <jimmyzelinskie@gmail.com> Jimmy Zelinskie <jimmyzelinskie@gmail.com>
Josh de Kock <josh@itanimul.li>
Justin Li <jli@j-li.net> Justin Li <jli@j-li.net>
Leo Balduf <balduf@hm.edu> Leo Balduf <balduf@hm.edu>

View file

@ -23,7 +23,9 @@ func announceRequest(r *http.Request, cfg *httpConfig) (*chihaya.AnnounceRequest
request := &chihaya.AnnounceRequest{Params: q} request := &chihaya.AnnounceRequest{Params: q}
eventStr, err := q.String("event") eventStr, err := q.String("event")
if err != nil { if err == query.ErrKeyNotFound {
eventStr = ""
} else if err != nil {
return nil, tracker.ClientError("failed to parse parameter: event") return nil, tracker.ClientError("failed to parse parameter: event")
} }
request.Event, err = event.New(eventStr) request.Event, err = event.New(eventStr)