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

Fix example recording when using send_file #504

Merged
merged 1 commit into from
Aug 25, 2017
Merged

Fix example recording when using send_file #504

merged 1 commit into from
Aug 25, 2017

Conversation

tdeo
Copy link
Contributor

@tdeo tdeo commented Nov 22, 2016

When recording an example of a controller that calls send_file, I'm getting this exception because of the binary content:

Writing examples to a file
/home/vagrant/pricematch/admin/vendor/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:34:in `encode': "\xEC" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
	from /home/vagrant/pricematch/admin/vendor/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:34:in `to_json'
	from /home/vagrant/pricematch/admin/vendor/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:34:in `to_json_with_active_support_encoder'
	from /home/vagrant/pricematch/admin/vendor/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:34:in `to_json'
	from /home/vagrant/pricematch/admin/vendor/ruby/2.2.0/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:34:in `to_json_with_active_support_encoder'
	from /home/vagrant/pricematch/admin/vendor/ruby/2.2.0/gems/json-1.8.3/lib/json/common.rb:285:in `generate'
	from /home/vagrant/pricematch/admin/vendor/ruby/2.2.0/gems/json-1.8.3/lib/json/common.rb:285:in `pretty_generate'
	from /home/vagrant/pricematch/admin/vendor/ruby/2.2.0/gems/apipie-rails-0.3.4/lib/apipie/extractor/writer.rb:43:in `block in write_recorded_examples'
	from /home/vagrant/pricematch/admin/vendor/ruby/2.2.0/gems/apipie-rails-0.3.4/lib/apipie/extractor/writer.rb:42:in `open'
	from /home/vagrant/pricematch/admin/vendor/ruby/2.2.0/gems/apipie-rails-0.3.4/lib/apipie/extractor/writer.rb:42:in `write_recorded_examples'
	from /home/vagrant/pricematch/admin/vendor/ruby/2.2.0/gems/apipie-rails-0.3.4/lib/apipie/extractor/writer.rb:13:in `write_examples'
	from /home/vagrant/pricematch/admin/vendor/ruby/2.2.0/gems/apipie-rails-0.3.4/lib/apipie/extractor.rb:78:in `write_examples'
	from /home/vagrant/pricematch/admin/vendor/ruby/2.2.0/gems/apipie-rails-0.3.4/lib/apipie/extractor.rb:46:in `finish'
	from /home/vagrant/pricematch/admin/vendor/ruby/2.2.0/gems/apipie-rails-0.3.4/lib/apipie/extractor.rb:179:in `block in <top (required)>'

This PR fixes it, at least for me (I'm just replacing the binary contents by a placeholder string)

@tdeo
Copy link
Contributor Author

tdeo commented Aug 25, 2017

@iNecas Do you think this PR makes sense ?

@iNecas
Copy link
Member

iNecas commented Aug 25, 2017

Makes sense to me. Sry I've missed this one. Merging now. Thanks @tdeo

@iNecas iNecas merged commit 2189428 into Apipie:master Aug 25, 2017
@tdeo
Copy link
Contributor Author

tdeo commented Aug 25, 2017

Thanks for the reactivity!

@tdeo tdeo deleted the skip_attachment_bodies branch August 25, 2017 13:12
@iNecas
Copy link
Member

iNecas commented Aug 25, 2017

Thanks for the contribution!

@iNecas
Copy link
Member

iNecas commented Sep 7, 2017

Apipie-rails-0.5.3 with the fix was just released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants