New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement custom debug function that shows post data #102

Closed
hadley opened this Issue Apr 22, 2014 · 0 comments

Comments

Projects
None yet
1 participant
@hadley
Member

hadley commented Apr 22, 2014

Should replace verbose().

  • Needs option to turn informative messages on (not usually that helpful)
  • Needs option to show data in/out
  • Needs helper for nice indenting
library(httr)

update <- function(msg, type, curl)  {
  switch(type + 1, 
    text = NULL, # message("* ", msg, appendLF = FALSE),
    headerIn = message("<  ", msg, appendLF = FALSE),
    headerOut = message(">  ", msg, appendLF = FALSE),
    dataIn = NULL,
    dataOut = message(">> ", msg),
    sslDataIn = NULL,
    sslDataOut = NULL,
  )
}

my_verbose <- c(config(debugfunction = update), verbose())

b2 <- "http://httpbin.org/post"
x <- POST(b2, body = "A simple text string", my_verbose)
x <- POST(b2, body = list(x = "A simple text string"), my_verbose)
x <- POST(b2, body = list(x = "A simple text string"), my_verbose, multipart = FALSE)
x <- POST(b2, body = list(y = upload_file(system.file("CITATION"))), my_verbose)
x <- POST(b2, body = NULL, my_verbose)
x <- POST(b2, body = "", my_verbose)
x <- POST(b2, body = FALSE, my_verbose)

@hadley hadley closed this in 89ce037 Apr 22, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment