# HG changeset patch # User Peter Sanchez # Date 1682749820 21600 # Sat Apr 29 00:30:20 2023 -0600 # Node ID d771782b98279d06d80cb9d06b85145e6c2bf2bf # Parent c85b38ec8fac52f710d56447f4e96a32b475470d Fixing json introspect output diff --git a/routes.go b/routes.go --- a/routes.go +++ b/routes.go @@ -87,45 +87,45 @@ ctype := req.Header.Get("Content-Type") if ctype != "application/x-www-form-urlencoded" { retErr := struct { - err string `json:"error"` - desc string `json:"error_description"` - uri string `json:"error_url"` // TODO Make this customizable + Err string `json:"error"` + Desc string `json:"error_description"` + URI string `json:"error_url"` // TODO Make this customizable }{ - err: "invalid request", - desc: "Content-Type must be application/x-www-form-urlencoded", + Err: "invalid request", + Desc: "Content-Type must be application/x-www-form-urlencoded", } return c.JSON(http.StatusBadRequest, &retErr) } retFalse := struct { - active bool `json:"active"` + Active bool `json:"active"` }{false} token := ForContext(req.Context()) if token == nil { - return c.JSON(http.StatusOK, retFalse) + return c.JSON(http.StatusOK, &retFalse) } if token.Token.ClientID == "" { - return c.JSON(http.StatusOK, retFalse) + return c.JSON(http.StatusOK, &retFalse) } ret := struct { - active bool `json:"active"` - clientID string `json:"client_id"` - username string `json:"username"` - tokenType string `json:"token_type"` - exp int `json:"exp"` - iat int `json:"iat"` + Active bool `json:"active"` + ClientID string `json:"client_id"` + Username string `json:"username"` + TokenType string `json:"token_type"` + Exp int `json:"exp"` + Iat int `json:"iat"` }{ - active: true, - clientID: token.Token.ClientID, - username: token.User.GetEmail(), - tokenType: "bearer", - exp: int(token.Token.Expires), - iat: int(token.Token.Issued), + Active: true, + ClientID: token.Token.ClientID, + Username: token.User.GetEmail(), + TokenType: "bearer", + Exp: int(token.Token.Expires), + Iat: int(token.Token.Issued), } - return c.JSON(http.StatusOK, ret) + return c.JSON(http.StatusOK, &ret) } // RouteName ...