Learn R Programming

vcr (version 0.2.6)

UnhandledHTTPRequestError: UnhandledHTTPRequestError

Description

UnhandledHTTPRequestError

Arguments

request

a request

cassette

a cassette, the current cassette

Error situations where this is invoked

  • record=once AND there's a new request that doesn't match the one in the cassette on disk

    • in webmockr: if no stub found and there are recorded interactions on the cassette, and record = once, then error with UnhandledHTTPRequestError

      • but if record != once, then allow it, unless record == none

  • others?

Details

How this error class is used: If record="once" we trigger this.

Users can use vcr in the context of both use_cassette and insert_cassette.

For the former, all requests go through the call_block But for the latter, requests go through webmockr

Where is one place where we can put UnhandledHTTPRequestError that will handle both use_cassette and insert_cassette?

Examples

Run this code
# NOT RUN {
vcr_configure(dir = tempdir())
cassettes()
insert_cassette("turtle")
request <- Request$new("post", 'https://eu.httpbin.org/post?a=5',
  "", list(foo = "bar"))

err <- UnhandledHTTPRequestError$new(request)
err$request_description()
err$current_matchers()
err$match_request_on_headers()
err$match_request_on_body()
err$formatted_headers()
cat(err$formatted_headers(), "\n")
cat(err$cassettes_description(), "\n")
cat(err$cassettes_list(), "\n")
err$formatted_suggestions()
cat(err$format_bullet_point('foo bar', 1), "\n")
err$suggestion_for("use_new_episodes")
err$suggestions()
err$no_cassette_suggestions()
err$record_mode_suggestion()
err$has_used_interaction_matching()
err$match_requests_on_suggestion()

# err$construct_message()

# cleanup
unlink(tempdir())
# }

Run the code above in your browser using DataLab