{"size": 1637, "ext": "scrbl", "max_stars_repo_path": "request/param.scrbl", "max_stars_repo_name": "yurkobb/racket-request", "max_stars_repo_stars_event_min_datetime": "2015-09-10T00:32:04.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-25T21:00:17.000Z", "max_issues_repo_path": "request/param.scrbl", "max_issues_repo_name": "yurkobb/racket-request", "max_issues_repo_issues_event_min_datetime": "2015-07-20T19:57:43.000Z", "max_issues_repo_issues_event_max_datetime": "2020-05-30T06:21:09.000Z", "max_forks_repo_path": "request/param.scrbl", "max_forks_repo_name": "yurkobb/racket-request", "max_forks_repo_forks_event_min_datetime": "2015-07-13T06:34:05.000Z", "max_forks_repo_forks_event_max_datetime": "2019-06-07T15:01:08.000Z"}
{"max_stars_count": 21, "max_issues_count": 19, "max_forks_count": 6, "avg_line_length": 31.4807692308, "max_line_length": 67, "alphanum_fraction": 0.6310323763}
#lang scribble/manual

@(require "doc-utils/examples.rkt"
          "doc-utils/def.rkt"
          "private/base.rkt"
          (for-label (except-in request get put post delete)
                     racket
                     request/param))

@title{Parameterized Requests}

@defmodule[request/param]

When using requesters, it is usually the case that
first a requester is constructed, then all requests
are made with it. This makes specifying the requester
in each request verbose and redundant. This module
provides request functions that operate using a
@racket[current-requester] parameter which can be
modified using @racket[with-requester].

@defparam[current-requester requester requester?
          #:value http-requester]{
  The current requester. Defaults to the simple
  @racket[http-requester].
}

@defform[(with-requester requester-expr body ...)
         #:contracts ([requester-expr requester?])]{
  @racket[parameterize]s the @racket[current-requester] to
  the result of @racket[requester-expr] in @racket[body ...].
}

@deftogether[(
  @defproc[(get [location any/c]
                [#:headers headers list? '()])
           any/c]
  @defproc[(put [location any/c]
                [body any/c]
                [#:headers headers list? '()])
           any/c]
  @defproc[(post [location any/c]
                 [body any/c]
                 [#:headers headers list? '()])
           any/c]
  @defproc[(delete [location any/c]
                   [#:headers headers list? '()])
           any/c])]{
  Equivalent to those defined in @racketmodname[request], but using
  the @racket[current-requester] to make requests.
}
