Skip to content

Programmatically get request body data #718

Closed
@sckott

Description

@sckott

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions