From 7221368cddc3e286528ef6bc107cc36f6b7d6e81 Mon Sep 17 00:00:00 2001 From: Ivan Lazar Miljenovic Date: Fri, 28 Jul 2017 15:32:19 +1000 Subject: [PATCH 1/2] Move location of header information Currently, it appears after the notes, authentication and capture information... such that if any of those exist, then the list of header sensitivity will appear to be an item of one of the previous ones (as they provide Markdown headers). --- servant-docs/src/Servant/Docs/Internal.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/servant-docs/src/Servant/Docs/Internal.hs b/servant-docs/src/Servant/Docs/Internal.hs index f253715e..912766cd 100644 --- a/servant-docs/src/Servant/Docs/Internal.hs +++ b/servant-docs/src/Servant/Docs/Internal.hs @@ -525,10 +525,10 @@ markdown api = unlines $ printEndpoint endpoint action = str : "" : + headersStr (action ^. headers) ++ notesStr (action ^. notes) ++ authStr (action ^. authInfo) ++ capturesStr (action ^. captures) ++ - headersStr (action ^. headers) ++ paramsStr (action ^. params) ++ rqbodyStr (action ^. rqtypes) (action ^. rqbody) ++ responseStr (action ^. response) ++ From a2c6ef773dc19a88763288bd292c24fd3155ed24 Mon Sep 17 00:00:00 2001 From: Ivan Lazar Miljenovic Date: Mon, 31 Jul 2017 10:56:01 +1000 Subject: [PATCH 2/2] Changed to adding a Headers header As per request by @phadej --- servant-docs/src/Servant/Docs/Internal.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/servant-docs/src/Servant/Docs/Internal.hs b/servant-docs/src/Servant/Docs/Internal.hs index 912766cd..fe935d6f 100644 --- a/servant-docs/src/Servant/Docs/Internal.hs +++ b/servant-docs/src/Servant/Docs/Internal.hs @@ -525,10 +525,10 @@ markdown api = unlines $ printEndpoint endpoint action = str : "" : - headersStr (action ^. headers) ++ notesStr (action ^. notes) ++ authStr (action ^. authInfo) ++ capturesStr (action ^. captures) ++ + headersStr (action ^. headers) ++ paramsStr (action ^. params) ++ rqbodyStr (action ^. rqtypes) (action ^. rqbody) ++ responseStr (action ^. response) ++ @@ -588,7 +588,12 @@ markdown api = unlines $ headersStr :: [Text] -> [String] headersStr [] = [] - headersStr l = [""] ++ map headerStr l ++ [""] + headersStr l = + "#### Headers:" : + "" : + map headerStr l ++ + "" : + [] where headerStr hname = "- This endpoint is sensitive to the value of the **" ++ unpack hname ++ "** HTTP header."