jeko2000 / tiny-routes Goto Github PK
View Code? Open in Web Editor NEWA tiny routing library for Common Lisp targeting Clack.
A tiny routing library for Common Lisp targeting Clack.
*cookie3* and *cookie4* are set to expire on "25 Jan 2002 19:22:06", but the test looks for the string "26 Jan 2002 00:22:06".
Why the 5 hours gap?
Looks like a mismatch between Eastern Time Zone and GMT.
encode-universal-time and decode-universal-time take extra &optional argument timezone time-zone, maybe you eed to use this.
Sinatra allows matching against splat or wildcard parameters.
Per their docs:
get '/say/*/to/*' do
# matches /say/hello/to/world
params['splat'] # => ["hello", "world"]
end
get '/download/*.*' do
# matches /download/path/to/file.xml
params['splat'] # => ["path/to/file", "xml"]
end
It may be useful to write a path-template matcher implementation to emulate this behavior.
The current implementation of wrap-request-body (shown below) leverages an internal read-stream-to-string function to slurp an input stream to a string.
(defun wrap-request-body (handler)
"Wrap HANDLER such that the request body is read to a string and made
available to the request via `:request-body'."
(lambda (request)
(let* ((stream (raw-body request))
(body (read-stream-to-string stream)))
(funcall handler (request-append request :request-body body)))))
Please consider allowing the client to pass their own stream->string slurping function to this middleware via an optional parameter. For example,
(defun wrap-request-body (handler &optional (stream-string-reader #'read-stream-to-string))
...)
(wrap-request-body handler #'uiop:slurp-stream-string)
The current implementation of wrap-request-body
will attempt to read the request stream regardless of its size. As such, this function is susceptible to some DoS attacks where requests contains large bodies.
Consider adding an optional max-bytes
parameter representing the maximum number of bytes that wrap-request-body
will read before returning a failed response.
Please add middleware support for HTTP cookies.
Instead of rolling your own, consider using fukamachi cl-cookie library: https://github.com/fukamachi/cl-cookie
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.