From b66de5eb3dc7d712413044a178b619f326f3aa8a Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Tue, 19 Jun 2012 09:01:00 +0000 Subject: Profile: Do not freak out when clients send requests without an Accept header. --- src/mulk/benki/id.clj | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mulk/benki/id.clj b/src/mulk/benki/id.clj index 4265945..56a86ee 100644 --- a/src/mulk/benki/id.clj +++ b/src/mulk/benki/id.clj @@ -137,13 +137,16 @@ (process-openid-request)) (defn render-profile-page [nickname] - (if (re-find #"application/xrds\+xml" - (get-in (request/ring-request) [:headers "accept"])) - (render-xrds nickname) - (show-profile-page (nickname-user nickname)))) + (let [accept (get-in (request/ring-request) [:headers "accept"])] + (if (and accept + (re-find #"application/xrds\+xml" + (get-in (request/ring-request) [:headers "accept"]))) + (render-xrds nickname) + (show-profile-page (nickname-user nickname))))) (defpage [:get "/id/:nickname"] {nickname :nickname} (render-profile-page nickname)) (defpage [:get "/~:nickname"] {nickname :nickname} (render-profile-page nickname)) + -- cgit v1.2.3