Request, Response, Route, WebSocket operations.
All response and request accessor functions participate in the anomaly railway pattern: if passed an anomaly map (e.g. from a failed navigate), they pass it through unchanged instead of throwing ClassCastException.
Request, Response, Route, WebSocket operations. All response and request accessor functions participate in the anomaly railway pattern: if passed an anomaly map (e.g. from a failed navigate), they pass it through unchanged instead of throwing ClassCastException.
(request-all-headers req)Returns all request headers including redirects. Passes through anomaly maps unchanged.
Returns all request headers including redirects. Passes through anomaly maps unchanged.
(request-failure req)Returns the failure text if the request failed. Passes through anomaly maps unchanged.
Returns the failure text if the request failed. Passes through anomaly maps unchanged.
(request-frame req)Returns the frame that initiated this request. Passes through anomaly maps unchanged.
Returns the frame that initiated this request. Passes through anomaly maps unchanged.
(request-headers req)Returns the request headers as a map. Passes through anomaly maps unchanged.
Returns the request headers as a map. Passes through anomaly maps unchanged.
(request-is-navigation? req)Returns whether this is a navigation request. Passes through anomaly maps unchanged.
Returns whether this is a navigation request. Passes through anomaly maps unchanged.
(request-method req)Returns the request HTTP method. Passes through anomaly maps unchanged.
Returns the request HTTP method. Passes through anomaly maps unchanged.
(request-post-data req)Returns the request POST data. Passes through anomaly maps unchanged.
Returns the request POST data. Passes through anomaly maps unchanged.
(request-post-data-buffer req)Returns the request POST data as bytes. Passes through anomaly maps unchanged.
Returns the request POST data as bytes. Passes through anomaly maps unchanged.
(request-redirected-from req)Returns the request that redirected to this one. Passes through anomaly maps unchanged.
Returns the request that redirected to this one. Passes through anomaly maps unchanged.
(request-redirected-to req)Returns the request this was redirected to. Passes through anomaly maps unchanged.
Returns the request this was redirected to. Passes through anomaly maps unchanged.
(request-resource-type req)Returns the resource type (e.g. document, script, image). Passes through anomaly maps unchanged.
Returns the resource type (e.g. document, script, image). Passes through anomaly maps unchanged.
(request-response req)Returns the response for this request. Passes through anomaly maps unchanged.
Returns the response for this request. Passes through anomaly maps unchanged.
(request-timing req)Returns the request timing information. Passes through anomaly maps unchanged.
Returns the request timing information. Passes through anomaly maps unchanged.
(request-url req)Returns the request URL. Passes through anomaly maps unchanged.
Returns the request URL. Passes through anomaly maps unchanged.
(response-all-headers resp)Returns all response headers. Passes through anomaly maps unchanged.
Returns all response headers. Passes through anomaly maps unchanged.
(response-body resp)Returns the response body as bytes. Passes through anomaly maps unchanged.
Returns the response body as bytes. Passes through anomaly maps unchanged.
(response-finished resp)Returns nil when response finishes, or the failure error string. Passes through anomaly maps unchanged.
Returns nil when response finishes, or the failure error string. Passes through anomaly maps unchanged.
(response-frame resp)Returns the frame that received this response. Passes through anomaly maps unchanged.
Returns the frame that received this response. Passes through anomaly maps unchanged.
(response-header-value resp name)Returns the value of a specific header. Passes through anomaly maps unchanged.
Returns the value of a specific header. Passes through anomaly maps unchanged.
(response-header-values resp name)Returns all values for a specific header. Passes through anomaly maps unchanged.
Returns all values for a specific header. Passes through anomaly maps unchanged.
(response-headers resp)Returns the response headers. Passes through anomaly maps unchanged.
Returns the response headers. Passes through anomaly maps unchanged.
(response-ok? resp)Returns whether the response status is 2xx. Passes through anomaly maps unchanged.
Returns whether the response status is 2xx. Passes through anomaly maps unchanged.
(response-request resp)Returns the request for this response. Passes through anomaly maps unchanged.
Returns the request for this response. Passes through anomaly maps unchanged.
(response-status resp)Returns the HTTP status code. Passes through anomaly maps unchanged.
Returns the HTTP status code. Passes through anomaly maps unchanged.
(response-status-text resp)Returns the HTTP status text. Passes through anomaly maps unchanged.
Returns the HTTP status text. Passes through anomaly maps unchanged.
(response-text resp)Returns the response body as text. Passes through anomaly maps unchanged.
Returns the response body as text. Passes through anomaly maps unchanged.
(response-url resp)Returns the response URL. Passes through anomaly maps unchanged.
Returns the response URL. Passes through anomaly maps unchanged.
(route-abort! route)(route-abort! route error-code)Aborts the route.
Params:
route - Route instance.
error-code - String, optional. Error code.
Aborts the route. Params: `route` - Route instance. `error-code` - String, optional. Error code.
(route-continue! route)(route-continue! route opts)Continues the route, optionally modifying the request.
Params:
route - Route instance.
opts - Map, optional. Overrides.
Continues the route, optionally modifying the request. Params: `route` - Route instance. `opts` - Map, optional. Overrides.
(route-fallback! route)Falls through to the next route handler.
Params:
route - Route instance.
Falls through to the next route handler. Params: `route` - Route instance.
(route-fetch! route)Performs the request and returns the response.
Params:
route - Route instance.
Returns: APIResponse or anomaly map.
Performs the request and returns the response. Params: `route` - Route instance. Returns: APIResponse or anomaly map.
(route-fulfill! route opts)Fulfills the route with a custom response.
Params:
route - Route instance.
opts - Map with optional:
:status - Long. HTTP status code.
:headers - Map. Response headers.
:body - String or byte[]. Response body.
:content-type - String. Content type.
Fulfills the route with a custom response. Params: `route` - Route instance. `opts` - Map with optional: :status - Long. HTTP status code. :headers - Map. Response headers. :body - String or byte[]. Response body. :content-type - String. Content type.
(route-request route)Returns the request being routed.
Returns the request being routed.
(ws-is-closed? ws)Returns whether the WebSocket is closed.
Returns whether the WebSocket is closed.
(ws-on-close ws handler)Registers a handler for WebSocket close.
Params:
ws - WebSocket instance.
handler - Function that receives the WebSocket.
Registers a handler for WebSocket close. Params: `ws` - WebSocket instance. `handler` - Function that receives the WebSocket.
(ws-on-error ws handler)Registers a handler for WebSocket errors.
Params:
ws - WebSocket instance.
handler - Function that receives the error string.
Registers a handler for WebSocket errors. Params: `ws` - WebSocket instance. `handler` - Function that receives the error string.
(ws-on-message ws handler)Registers a handler for incoming messages.
Params:
ws - WebSocket instance.
handler - Function that receives a WebSocketFrame.
Registers a handler for incoming messages. Params: `ws` - WebSocket instance. `handler` - Function that receives a WebSocketFrame.
(wsf-binary frame)Returns the binary content of a WebSocket frame.
Returns the binary content of a WebSocket frame.
(wsf-text frame)Returns the text content of a WebSocket frame.
Returns the text content of a WebSocket frame.
(wsr-close! wsr)Closes the WebSocket connection from the server side.
Params:
wsr - WebSocketRoute instance.
Closes the WebSocket connection from the server side. Params: `wsr` - WebSocketRoute instance.
(wsr-connect-to-server! wsr)Connects to the real server WebSocket.
Params:
wsr - WebSocketRoute instance.
Returns: WebSocketRoute for the server connection.
Connects to the real server WebSocket. Params: `wsr` - WebSocketRoute instance. Returns: WebSocketRoute for the server connection.
(wsr-on-close wsr handler)Registers a handler for close events.
Params:
wsr - WebSocketRoute instance.
handler - Function called on close.
Registers a handler for close events. Params: `wsr` - WebSocketRoute instance. `handler` - Function called on close.
(wsr-on-message wsr handler)Registers a handler for client messages on the route.
Params:
wsr - WebSocketRoute instance.
handler - Function that receives WebSocketFrame.
Registers a handler for client messages on the route. Params: `wsr` - WebSocketRoute instance. `handler` - Function that receives WebSocketFrame.
(wsr-send! wsr message)Sends a message to the client.
Params:
wsr - WebSocketRoute instance.
message - String. Message to send.
Sends a message to the client. Params: `wsr` - WebSocketRoute instance. `message` - String. Message to send.
(wsr-url wsr)Returns the URL of a WebSocketRoute.
Returns the URL of a WebSocketRoute.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |