(w http.ResponseWriter, status int, obj interface{})
| 38 | } |
| 39 | |
| 40 | func sendJSON(w http.ResponseWriter, status int, obj interface{}) error { |
| 41 | w.Header().Set("Content-Type", "application/json") |
| 42 | b, err := json.Marshal(obj) |
| 43 | if err != nil { |
| 44 | return errors.Wrap(err, fmt.Sprintf("Error encoding json response: %v", obj)) |
| 45 | } |
| 46 | w.WriteHeader(status) |
| 47 | _, err = w.Write(b) |
| 48 | return err |
| 49 | } |
| 50 | |
| 51 | func getUserFromClaims(ctx context.Context, conn *storage.Connection) (*models.User, error) { |
| 52 | claims := getClaims(ctx) |
no test coverage detected
searching dependent graphs…