diff options
Diffstat (limited to 'model/authorize.go')
-rw-r--r-- | model/authorize.go | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/model/authorize.go b/model/authorize.go index df07ff142..2296e7e22 100644 --- a/model/authorize.go +++ b/model/authorize.go @@ -115,43 +115,25 @@ func (ad *AuthData) PreSave() { } func (ad *AuthData) ToJson() string { - b, err := json.Marshal(ad) - if err != nil { - return "" - } else { - return string(b) - } + b, _ := json.Marshal(ad) + return string(b) } func AuthDataFromJson(data io.Reader) *AuthData { - decoder := json.NewDecoder(data) - var ad AuthData - err := decoder.Decode(&ad) - if err == nil { - return &ad - } else { - return nil - } + var ad *AuthData + json.NewDecoder(data).Decode(&ad) + return ad } func (ar *AuthorizeRequest) ToJson() string { - b, err := json.Marshal(ar) - if err != nil { - return "" - } else { - return string(b) - } + b, _ := json.Marshal(ar) + return string(b) } func AuthorizeRequestFromJson(data io.Reader) *AuthorizeRequest { - decoder := json.NewDecoder(data) - var ar AuthorizeRequest - err := decoder.Decode(&ar) - if err == nil { - return &ar - } else { - return nil - } + var ar *AuthorizeRequest + json.NewDecoder(data).Decode(&ar) + return ar } func (ad *AuthData) IsExpired() bool { |