Description
via ropensci/vcr#276 discussion
There may be other use cases, but the use case for this right now is in vcr
we want to record in a vcr cassette the same information that is sent in a real HTTP request for the request body.
There is httr2:::req_body_get()
but it is not exported for one, for two it doesn't cover all body types, and three we'd need a way to gather the data that is sent in a real request for the request body.
One can run req_dry_run
to see what is sent but AFAICT the request body data isn't available from that call anyway.
Ideally for the vcr
use case there'd be a way to get the request body data as it would be sent in a real http request BEFORE making the request, because although we don't record the cassette until after the real request is made on first recording, on subsequent recordings of the matching request we'd need a way to determine the request body data WITHOUT having to make a real HTTP request (assuming that is, the user is matching on request body)
Activity
hadley commentedon Apr 23, 2025
Also need to export
req_method_get
so you don't needwebmockr:::req_method_get_w()
.Or maybe we could export
req_prepare()
which doesreq_method_apply()
andreq_body_apply()