Skip to content

pyr/aleph-params

Repository files navigation

aleph-params: Netty-inspired query string parameters decoding

Build Status cljdoc badge Clojars Project

Provides query string parameter parsing with no additional dependencies, borrowing the Netty battle tested code.

Usage

Further docs on https://cljdoc.org/d/spootnik/aleph-params/CURRENT

Ring style

Wrapped requests will have get-params at the :get-params key when applicable.

(require '[aleph.http.params :refer [wrap-params]])

(def handler
  (-> (constantly {:status 200 :body ""})
      (wrap-params)))

Interceptor

An interceptor is provided at aleph.http.params/interceptor, it provides a single :enter key and expects the request at the :request key in the context. Parameters are added at the :get-params key for downstream interceptors.

Plain parser

(require '[aleph.http.params :refer [parse-params]])

(parse-params "?foo=bar") ;; => {:foo "bar"}

About

Netty-based query string parameter parsing

Resources

License

Stars

Watchers

Forks

Packages

No packages published