From ca360e08dfcced1a12eab79981b1e94b81ca32e6 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Fri, 24 Aug 2018 12:55:17 -0400 Subject: [PATCH] Order list responses We do this already in the CLI, but because we do it there the UI doesn't have ordered responses. We could put it in the UI, but it seems like we might as well just make it nice for all API users. Fixes #5141 --- logical/response.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/logical/response.go b/logical/response.go index 96d4cce5e20e..6d6ce2251147 100644 --- a/logical/response.go +++ b/logical/response.go @@ -3,6 +3,7 @@ package logical import ( "encoding/json" "errors" + "sort" "github.com/hashicorp/vault/helper/wrapping" ) @@ -113,6 +114,7 @@ func ListResponse(keys []string) *Response { Data: map[string]interface{}{}, } if len(keys) != 0 { + sort.Strings(keys) resp.Data["keys"] = keys } return resp