From e1cae3b15b1a85fcb2ef30fee0076ae3a8d23856 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Fri, 6 May 2016 14:32:08 -0400 Subject: PLT-2600/PLT-2770 Changed getPublicLink api call to return a proper JSON string (#2914) * Removed unused channelId and userId parameters from web client getPublicLink method * Changed getPublicLink api call to return a proper JSON string --- model/utils.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'model/utils.go') diff --git a/model/utils.go b/model/utils.go index d9b06bd01..443a34bc4 100644 --- a/model/utils.go +++ b/model/utils.go @@ -178,6 +178,26 @@ func StringInterfaceFromJson(data io.Reader) map[string]interface{} { } } +func StringToJson(s string) string { + b, err := json.Marshal(s) + if err != nil { + return "" + } else { + return string(b) + } +} + +func StringFromJson(data io.Reader) string { + decoder := json.NewDecoder(data) + + var s string + if err := decoder.Decode(&s); err != nil { + return "" + } else { + return s + } +} + func IsLower(s string) bool { if strings.ToLower(s) == s { return true -- cgit v1.2.3-1-g7c22