ropensci / vcr

Record HTTP calls and replay them
https://docs.ropensci.org/vcr
Other
77 stars 12 forks source link

maybe: automatically store non-JSON response bodies as base64? #48

Open sckott opened 6 years ago

sckott commented 6 years ago

that I think is what is done in ruby VCR

sckott commented 6 years ago

it seems that ruby VCR somehow automatically stores response body on cassette as binary in some cases, e.g.,

➜  ~ curl -v http://v4.boldsystems.org/index.php/API_Public/combined\?taxon\=Osmia\&combined_download\=tsv
*   Trying 131.104.63.56...
* TCP_NODELAY set
* Connected to v4.boldsystems.org (131.104.63.56) port 80 (#0)
> GET /index.php/API_Public/combined?taxon=Osmia&combined_download=tsv HTTP/1.1
> Host: v4.boldsystems.org
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Mon, 30 Apr 2018 22:15:33 GMT
< Server: Apache/2.2.15 (Red Hat)
< X-Powered-By: PHP/5.3.15
< Content-Disposition: attachment; filename=bold_data.txt
< Connection: close
< Transfer-Encoding: chunked
< Content-Type: application/x-download
<
processid   sampleid    recordID    catalognum  fieldnum    institution_storing collection_code bin_uri phylum_taxID    phylum_name class_taxID class_name  order_taxID order_name  family_taxID    family_name subfamily_taxID subfamily_name  genus_taxID genus_name  species_taxID   species_name    subspecies_taxID    subspecies_name identification_provided_by  identification_method   identification_reference    tax_note    voucher_status  tissue_type collection_event_id collectors  collectiondate_start

... cutoff

perhaps ruby vcr is triggering binary storage due to the one of these two headers:

it's not gzipped or so, so that's not an issue. weird that marston says here https://groups.google.com/forum/#!topic/vcr-ruby/2sKrJa86ktU that the only way it will do binary storage is if you ask it to, but it doesn't appear to be true