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

12 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 false/c string?)

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

procedure

(bindings-ref-bytes bindings name [default])

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

procedure

(bindings-ref-number bindings name [default])

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

procedure

(bindings-ref-symbol bindings name [default])

  (or/c false/c symbol?)
  bindings : (listof binding?)
  name : symbol?
  default : (or/c false/c 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"