diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2012-06-19 09:01:00 +0000 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2012-06-19 09:02:15 +0000 |
commit | b66de5eb3dc7d712413044a178b619f326f3aa8a (patch) | |
tree | c0db2c42eb6edb3a04caa2bd8f4aba2e2c486720 /src | |
parent | 93f3cd287e8d7ab72d14b2cfb21100ad3d07b14d (diff) |
Profile: Do not freak out when clients send requests without an Accept header.
Diffstat (limited to 'src')
-rw-r--r-- | src/mulk/benki/id.clj | 11 |
1 files changed, 7 insertions, 4 deletions
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)) + |