On this page:
request-path
bindings-ref
bindings-ref-bytes
bindings-ref-number
bindings-ref-symbol
url-scrub

13 HTTP🔗

 (require koyo/http) package: koyo-lib

This module provides utilities for working with HTTP-related data structures.

procedure

(request-path req)  string?

  req : request?
Returns the absolute request path for req, scrubbed of path params.

procedure

(bindings-ref bindings name [default])  (or/c #f string?)

  bindings : (listof binding?)
  name : symbol?
  default : (or/c #f string?) = #f

procedure

(bindings-ref-bytes bindings name [default])  (or/c #f bytes?)

  bindings : (listof binding?)
  name : symbol?
  default : (or/c #f bytes?) = #f

procedure

(bindings-ref-number bindings name [default])  (or/c #f number?)

  bindings : (listof binding?)
  name : symbol?
  default : (or/c #f number?) = #f

procedure

(bindings-ref-symbol bindings name [default])  (or/c #f symbol?)

  bindings : (listof binding?)
  name : symbol?
  default : (or/c #f symbol?) = #f
Finds the first binding in bindings whose name is name and returns its value or default.

procedure

(url-scrub u)  url?

  u : url?
Removes all the path params from u, while leaving its path intact. This is used by the default continuation mismatch handler to strip the current URL of its continuation id.

> (require koyo/http
           net/url)
> (url->string
   (url-scrub
    (string->url "https://127.0.0.1/foo/bar;(\"k\" . \"123\")/baz")))

"https://127.0.0.1/foo/bar/baz"