Liking cljdoc? Tell your friends :D

clj-http.stub


*call-counts*clj

source

*expected-counts*clj

source

*in-isolation*clj

source

*stub-routes*clj

source

address-string-forclj

source

body-bytesclj

(body-bytes obj)

If obj is a byte-array, return it, otherwise use utf8-bytes.

If `obj` is a byte-array, return it, otherwise use `utf8-bytes`.
sourceraw docstring

create-responseclj

(create-response response request)

Creates a response map with default values merged with the provided response. If response is a function, it will be called with the request as an argument. Returns a map with :status, :headers, and :body.

Creates a response map with default values merged with the provided response.
If response is a function, it will be called with the request as an argument.
Returns a map with :status, :headers, and :body.
sourceraw docstring

defaults-or-valueclj

(defaults-or-value defaults value)

Given a set of default values and a value, returns either:

  • a vector of all default values (reversed) if the value is in the defaults
  • a vector containing just the value if it's not in the defaults
Given a set of default values and a value, returns either:
- a vector of all default values (reversed) if the value is in the defaults
- a vector containing just the value if it's not in the defaults
sourceraw docstring

get-request-methodclj

(get-request-method request)

Gets the request method from the request map

Gets the request method from the request map
sourceraw docstring

get-request-query-paramsclj

(get-request-query-params request)

Extracts and normalizes query parameters from a request. Handles both :query-params and :query-string formats.

Extracts and normalizes query parameters from a request.
Handles both :query-params and :query-string formats.
sourceraw docstring

initialize-request-hookclj

(initialize-request-hook)
source

methods-match?clj

(methods-match? expected-method request)

Checks if a request method matches an expected method. Handles :any as a wildcard method.

Checks if a request method matches an expected method.
Handles :any as a wildcard method.
sourceraw docstring

normalize-pathclj

source

normalize-query-paramsclj

Normalizes query parameters to a consistent format. Handles both string and keyword keys, and converts all values to strings.

Normalizes query parameters to a consistent format.
Handles both string and keyword keys, and converts all values to strings.
sourceraw docstring

normalize-requestclj

(normalize-request request)
source

normalize-url-for-matchingclj

Normalizes a URL string by removing trailing slashes for consistent matching

Normalizes a URL string by removing trailing slashes for consistent matching
sourceraw docstring

parse-query-stringclj

Parses a query string into a map of normalized parameters. Returns empty map for nil or empty query string.

Parses a query string into a map of normalized parameters.
Returns empty map for nil or empty query string.
sourceraw docstring

parse-urlclj

(parse-url url)

Parse a URL string into a map containing :scheme, :server-name, :server-port, :uri, and :query-string

Parse a URL string into a map containing :scheme, :server-name, :server-port, :uri, and :query-string
sourceraw docstring

potential-alternatives-toclj

(potential-alternatives-to request uris-fn)
source

potential-query-strings-forclj

(potential-query-strings-for request-map)
source

potential-schemes-forclj

(potential-schemes-for request-map)
source

potential-server-ports-forclj

(potential-server-ports-for request-map)
source

potential-uris-forclj

(potential-uris-for request-map)

Returns a set of potential URIs for a request. Uses defaults-or-value to handle common cases like '/', '', or nil. Also handles URIs with or without trailing slashes and normalized paths.

Returns a set of potential URIs for a request.
Uses defaults-or-value to handle common cases like '/', '', or nil.
Also handles URIs with or without trailing slashes and normalized paths.
sourceraw docstring

query-params-match?clj

(query-params-match? expected-query-params request)
source

RouteMatchercljprotocol

matchesclj

(matches address method request)
source

try-interceptclj

(try-intercept origfn request)
(try-intercept origfn request respond raise)
source

utf8-bytesclj

(utf8-bytes s)

Returns the UTF-8 bytes corresponding to the given string.

Returns the UTF-8 bytes corresponding to the given string.
sourceraw docstring

validate-all-call-countsclj

(validate-all-call-counts)
source

with-global-http-stubcljmacro

(with-global-http-stub routes & body)
source

with-global-http-stub-basecljmacro

(with-global-http-stub-base routes wrap-body & body)

Base implementation of with-global-http-stub that both clj-http and httpkit extend

Base implementation of with-global-http-stub that both clj-http and httpkit extend
sourceraw docstring

with-global-http-stub-in-isolationcljmacro

(with-global-http-stub-in-isolation routes & body)
source

with-http-stubcljmacro

(with-http-stub routes & body)
source

with-http-stub-in-isolationcljmacro

(with-http-stub-in-isolation routes & body)
source

with-stub-bindingsclj

(with-stub-bindings routes body-fn)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close