This website works better with JavaScript.
Home
Explore
Help
Sign In
public
/
rpc
Watch
1
Star
0
Fork
0
Code
Issues
0
Pull Requests
0
Releases
0
Wiki
Activity
Browse Source
Public GetCodec function
master
johnl
4 years ago
parent
a91b1990ec
commit
220ac3457c
2 changed files
with
6 additions
and
1 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+5
-0
codec.go
+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
Write
Preview
Loading…
Cancel
Save