Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: tmciver/hottop
base: cb75628d3b
...
head fork: tmciver/hottop
compare: 7decfabcd6
  • 2 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jan 30, 2013
@tmciver Added github enhancement #1: change value of resource key
:redirect-after-html-post from URI string to a function of the Ring
request. Clean up and add to the comment doc in resource.clj. Bumped
version to 0.1.3 as this is a breaking API change.
a6e31cc
@tmciver Fixed broken test due to fix for github issue #1. 7decfab
View
2  project.clj
@@ -1,4 +1,4 @@
-(defproject hottop/hottop "0.1.2"
+(defproject hottop/hottop "0.1.3"
:min-lein-version "2.0.0"
:profiles {:dev
{:dependencies
View
2  src/hottop/proc.clj
@@ -111,7 +111,7 @@ web browser."
result (post-fn request)]
(if (util/response? result)
result
- (let [redirect-uri (:redirect-after-html-post resource)]
+ (let [redirect-uri ((:redirect-after-html-post resource) request)]
(if (and redirect-uri (util/accepts-html? request))
(ring/redirect-after-post redirect-uri)
(response/code 200))))))
View
18 src/hottop/resource.clj
@@ -15,23 +15,29 @@
;; functions of a single argument. These functions are intended to convert
;; data from the client into a more usable format (This needs to be defined
;; better).
+;; :auth
+;; A function whose only argument is the Ring request and which should
+;; return true if the user is authorized to access this resource, false
+;; otherwise.
;; :languages-provided
;; A set of strings representing language codes. Defaults to #{"en" "en-us"}.
+;; :redirect-after-html-post
+;; A function of the Ring request that returns a URI string to which the
+;; client will be redirect (via a 303 response). This occurs only if 1. the
+;; user supplies a redirect URI and 2. if the client lists either or both of
+;; 'text/html' or 'application/xhtml+xml' in the Accept header.
;; :methods
;; A map of HTTP method keywords to functions. The function associated with a
;; method should take one argument which will be the Ring request. The return
;; value can be any application-specific data structure. The returned data
;; structure will be passed to the function associated with the optimal
;; internet media type found in the :content-types-provided map.
-;; :auth
-;; A function whose only argument is the Ring request and which should
-;; return true if the user is authorized to access this resource, false
-;; otherwise.
+
(def base-resource {:content-types-provided {}
- :content-types-accepted {"application/x-www-form-urlencoded" 'some-fn-to-parse-like-from-Ring}
+ :content-types-accepted {}
:auth (constantly true)
:languages-provided #{"en" "en-us"}
- :redirect-after-html-post nil
+ :redirect-after-html-post (constantly nil)
:methods {}})
(defn create-readonly-html-resource
View
2  test/hottop/test/proc.clj
@@ -64,7 +64,7 @@
(header "Accept" "text/plain"))
resource (-> base-resource
(assoc-in [:methods :post] (constantly :do-nothing))
- (assoc :redirect-after-html-post "/foo")
+ (assoc :redirect-after-html-post (constantly "/foo"))
(assoc-in [:content-types-provided "text/html"] identity)
(assoc-in [:content-types-provided "text/plain"] identity))
response1 ((process-post (constantly :handler1)) request1 resource)

No commit comments for this range

Something went wrong with that request. Please try again.