Skip to content
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

Date field is not recognized as such #91

Closed
Bisaloo opened this issue Feb 1, 2019 · 5 comments
Closed

Date field is not recognized as such #91

Bisaloo opened this issue Feb 1, 2019 · 5 comments
Labels
Milestone

Comments

@Bisaloo
Copy link
Member

Bisaloo commented Feb 1, 2019

I am not sure whether should be fixed on vcr or httr side. Here's a reprex that will explain the issue better than I could:

library(vcr)
#> Loading required namespace: jsonlite
library(httr)

use_cassette("test", GET("https://example.org/"))
#> CrulAdapter enabled!
#> HttrAdapter enabled!
#> net connect allowed
#> net connect disabled
#> encoding couldn't be detected; assuming UTF-8
#> ejecting cassette: test
#> CrulAdapter disabled!
#> HttrAdapter disabled!
#> <vcr - Cassette> test
#>   Record method: once
#>   Serialize with: yaml
#>   Persist with: FileSystem
#>   update_content_length_header: FALSE
#>   decode_compressed_response: 
#>   allow_playback_repeats: FALSE
#>   allow_unused_http_interactions: 
#>   exclusive: 
#>   preserve_exact_body_bytes: FALSE

insert_cassette("test")
#> CrulAdapter enabled!
#> HttrAdapter enabled!
#> <vcr - Cassette> test
#>   Record method: once
#>   Serialize with: yaml
#>   Persist with: FileSystem
#>   update_content_length_header: FALSE
#>   decode_compressed_response: 
#>   allow_playback_repeats: FALSE
#>   allow_unused_http_interactions: 
#>   exclusive: 
#>   preserve_exact_body_bytes: FALSE
GET("https://example.org/")
#> Response [https://example.org/]
#> Error in format.default(x$date, "%Y-%m-%d %H:%M"): invalid 'trim' argument

Created on 2019-02-01 by the reprex package (v0.2.1)

Session info
devtools::session_info()
#> ─ Session info ──────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 3.5.2 (2018-12-20)
#>  os       Ubuntu 16.04.5 LTS          
#>  system   x86_64, linux-gnu           
#>  ui       X11                         
#>  language en_US                       
#>  collate  en_US.UTF-8                 
#>  ctype    en_US.UTF-8                 
#>  tz       Europe/Paris                
#>  date     2019-02-01                  
#> 
#> ─ Packages ──────────────────────────────────────────────────────────────
#>  package     * version date       lib source                             
#>  assertthat    0.2.0   2017-04-11 [1] CRAN (R 3.5.0)                     
#>  backports     1.1.3   2018-12-14 [1] CRAN (R 3.5.2)                     
#>  base64enc     0.1-3   2015-07-28 [1] CRAN (R 3.5.0)                     
#>  callr         3.1.1   2018-12-21 [1] CRAN (R 3.5.2)                     
#>  cli           1.0.1   2018-09-25 [1] CRAN (R 3.5.1)                     
#>  crayon        1.3.4   2017-09-16 [1] CRAN (R 3.5.0)                     
#>  crul          0.7.0   2019-01-04 [1] CRAN (R 3.5.2)                     
#>  curl          3.3     2019-01-10 [1] CRAN (R 3.5.2)                     
#>  desc          1.2.0   2018-05-01 [1] CRAN (R 3.5.0)                     
#>  devtools      2.0.1   2018-10-26 [1] CRAN (R 3.5.1)                     
#>  digest        0.6.18  2018-10-10 [1] CRAN (R 3.5.1)                     
#>  evaluate      0.12    2018-10-09 [1] CRAN (R 3.5.1)                     
#>  fauxpas       0.2.0   2018-03-01 [1] CRAN (R 3.5.2)                     
#>  fs            1.2.6   2018-08-23 [1] CRAN (R 3.5.1)                     
#>  glue          1.3.0   2018-07-17 [1] CRAN (R 3.5.1)                     
#>  highr         0.7     2018-06-09 [1] CRAN (R 3.5.1)                     
#>  htmltools     0.3.6   2017-04-28 [1] CRAN (R 3.5.0)                     
#>  httpcode      0.2.0   2016-11-14 [1] CRAN (R 3.5.2)                     
#>  httr        * 1.4.0   2018-12-11 [1] CRAN (R 3.5.2)                     
#>  jsonlite      1.6     2018-12-07 [1] CRAN (R 3.5.2)                     
#>  knitr         1.21    2018-12-10 [1] CRAN (R 3.5.2)                     
#>  lazyeval      0.2.1   2017-10-29 [1] CRAN (R 3.5.0)                     
#>  magrittr      1.5     2014-11-22 [1] CRAN (R 3.5.0)                     
#>  memoise       1.1.0   2017-04-21 [1] CRAN (R 3.5.0)                     
#>  mime          0.6     2018-10-05 [1] CRAN (R 3.5.1)                     
#>  pkgbuild      1.0.2   2018-10-16 [1] CRAN (R 3.5.1)                     
#>  pkgload       1.0.2   2018-10-29 [1] CRAN (R 3.5.1)                     
#>  prettyunits   1.0.2   2015-07-13 [1] CRAN (R 3.5.0)                     
#>  processx      3.2.1   2018-12-05 [1] CRAN (R 3.5.2)                     
#>  ps            1.3.0   2018-12-21 [1] CRAN (R 3.5.2)                     
#>  R6            2.3.0   2018-10-04 [1] CRAN (R 3.5.1)                     
#>  Rcpp          1.0.0   2018-11-07 [1] CRAN (R 3.5.1)                     
#>  remotes       2.0.2   2018-10-30 [1] CRAN (R 3.5.2)                     
#>  rlang         0.3.1   2019-01-08 [1] CRAN (R 3.5.2)                     
#>  rmarkdown     1.11    2018-12-08 [1] CRAN (R 3.5.2)                     
#>  rprojroot     1.3-2   2018-01-03 [1] CRAN (R 3.5.0)                     
#>  sessioninfo   1.1.1   2018-11-05 [1] CRAN (R 3.5.2)                     
#>  stringi       1.2.4   2018-07-20 [1] CRAN (R 3.5.1)                     
#>  stringr       1.3.1   2018-05-10 [1] CRAN (R 3.5.0)                     
#>  testthat      2.0.1   2018-10-13 [1] CRAN (R 3.5.2)                     
#>  triebeard     0.3.0   2016-08-04 [1] CRAN (R 3.5.1)                     
#>  urltools      1.7.1   2018-11-07 [1] Github (ironholds/urltools@02eb12e)
#>  usethis       1.4.0   2018-08-14 [1] CRAN (R 3.5.1)                     
#>  vcr         * 0.2.2   2019-01-13 [1] CRAN (R 3.5.2)                     
#>  webmockr      0.3.0   2019-01-09 [1] CRAN (R 3.5.2)                     
#>  withr         2.1.2   2018-03-15 [1] CRAN (R 3.5.0)                     
#>  xfun          0.4.4   2018-11-30 [1] Github (yihui/xfun@792175f)        
#>  yaml          2.2.0   2018-07-25 [1] CRAN (R 3.5.1)                     
#> 
#> [1] /home/hugo/R/x86_64-pc-linux-gnu-library/3.5
#> [2] /usr/local/lib/R/site-library
#> [3] /usr/lib/R/site-library
#> [4] /usr/lib/R/library

This happens on L36 of response.r from httr.

@sckott
Copy link
Collaborator

sckott commented Feb 1, 2019

thanks for the report @Bisaloo , having a look

@sckott
Copy link
Collaborator

sckott commented Feb 1, 2019

it's actually a fix needed in webmockr. https://github.com/ropensci/webmockr/blob/master/R/adapter-httr.R#L309-L312

I was just using the date from the response header directly, but httr parses the http response date to another format to put in to the x$date slot in the response

opened an issue in webmockr, you can see the ping above

sckott added a commit that referenced this issue Feb 1, 2019
@sckott
Copy link
Collaborator

sckott commented Feb 1, 2019

@Bisaloo install from master remotes::install_github("ropensci/vcr") and i will pull down a dev webmockr too. reload session, and try again.

@Bisaloo
Copy link
Member Author

Bisaloo commented Feb 2, 2019

Confirmed fixed. Thank you for your responsiveness!

@Bisaloo Bisaloo closed this as completed Feb 2, 2019
@sckott sckott added this to the v0.2.4 milestone Feb 2, 2019
@sckott
Copy link
Collaborator

sckott commented Feb 2, 2019

and thanks for the detailed report

@sckott sckott added the bug label Feb 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants