Browse Source

Public GetCodec function

master
johnl 4 years ago
parent
commit
220ac3457c
2 changed files with 6 additions and 1 deletions
  1. +5
    -0
      codec.go
  2. +1
    -1
      server.go

+ 5
- 0
codec.go View File

@ -91,3 +91,8 @@ var codecMap = map[string]Codec{
CodecJSON: jsonCodec{},
CodecMsgPack: msgPackCodec{},
}
func GetCodec(id string) (Codec, bool) {
codec, ok := codecMap[id]
return codec, ok
}

+ 1
- 1
server.go View File

@ -29,7 +29,7 @@ func NewHandlerFunc(obj interface{}, cookieName string) http.HandlerFunc {
return
}
codec, ok := codecMap[codecID]
codec, ok := GetCodec(codecID)
if !ok {
http.Error(w, "Not found.", http.StatusNotFound)
return


Loading…
Cancel
Save