Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ftw/httpd/endpoint-test.ss
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
(default-handler req res))
(catch (e) (http-response-write
res 500 '(("Content-Type" . "text/plain"))
(with-output-to-string (cut display-exception e))))))
(with-output-to-string "" (cut display-exception e))))))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it is too type restrictive it should be fixed in gerbil

(def eq (endpoint-queue))

(def (test-endpoint-queue-handler req res)
Expand All @@ -62,7 +62,7 @@
(default-handler req res))
(catch (e) (http-response-write
res 500 '(("Content-Type" . "text/plain"))
(with-output-to-string (cut display-exception e))))))
(with-output-to-string "" (cut display-exception e))))))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.


(def (testq/GET num arg)
(http-response-write* 200 '(("Content-Type" . "text/plain"))
Expand Down
7 changes: 4 additions & 3 deletions ftw/httpd/endpoint.org
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ dispatcher function attached which returns a true value if successful.
(default-handler req res))
(catch (e) (http-response-write
res 500 '(("Content-Type" . "text/plain"))
(with-output-to-string (cut display-exception e))))))
(with-output-to-string "" (cut display-exception e))))))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here


(def (testq/GET num arg)
(http-response-write* 200 '(("Content-Type" . "text/plain"))
Expand Down Expand Up @@ -773,7 +773,8 @@ request.

#+begin_src gerbil
(defmethod {endpoint-match-predicate endpoint}
(lambda (self (m (endpoint-match self)))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uhm, this should work though, needs to be fixed in gerbil.

(lambda (self (m #f))
(unless m (set! m (endpoint-match self)))
(cond ((string? m) (endpoint-pregexp-match-predicate self))
((procedure? m) m)
(#t (error "Endpoint Match is not a string or a procedure")))))
Expand Down Expand Up @@ -882,7 +883,7 @@ Now a simple handler to register with the existing mux.
(default-handler req res))
(catch (e) (http-response-write
res 500 '(("Content-Type" . "text/plain"))
(with-output-to-string (cut display-exception e))))))
(with-output-to-string "" (cut display-exception e))))))
#+end_src
Let's make sure it works!

Expand Down
3 changes: 2 additions & 1 deletion ftw/httpd/endpoint/struct.ss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
(let ((groups (pregexp-match (endpoint-match endpoint) path)))
(and groups (cdr groups)))))
(defmethod {endpoint-match-predicate endpoint}
(lambda (self (m (endpoint-match self)))
(lambda (self (m #f))
(unless m (set! m (endpoint-match self)))
(cond ((string? m) (endpoint-pregexp-match-predicate self))
((procedure? m) m)
(#t (error "Endpoint Match is not a string or a procedure")))))
Expand Down