http/request: check if query.ErrKeyNotFound for event
This commit is contained in:
parent
978c6a36e7
commit
01abcad893
1 changed files with 4 additions and 2 deletions
|
@ -23,8 +23,10 @@ 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 = "none"
|
eventStr = ""
|
||||||
|
} else if err != nil {
|
||||||
|
return nil, tracker.ClientError("failed to parse parameter: event")
|
||||||
}
|
}
|
||||||
request.Event, err = event.New(eventStr)
|
request.Event, err = event.New(eventStr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue