logstash-output-scalyr 0.1.9 → 0.1.14.beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/Gemfile +5 -0
- data/README.md +2 -2
- data/lib/logstash/outputs/scalyr.rb +265 -142
- data/lib/scalyr/common/client.rb +80 -57
- data/lib/scalyr/common/util.rb +7 -0
- data/lib/scalyr/constants.rb +2 -0
- data/logstash-output-scalyr.gemspec +1 -1
- data/spec/logstash/outputs/scalyr_integration_spec.rb +187 -8
- data/spec/logstash/outputs/scalyr_spec.rb +12 -6
- data/vendor/bundle/jruby/2.5.0/cache/addressable-2.7.0.gem +0 -0
- data/vendor/bundle/jruby/2.5.0/cache/crack-0.4.5.gem +0 -0
- data/vendor/bundle/jruby/2.5.0/cache/hashdiff-1.0.1.gem +0 -0
- data/vendor/bundle/jruby/2.5.0/cache/public_suffix-4.0.6.gem +0 -0
- data/vendor/bundle/jruby/2.5.0/cache/rexml-3.2.5.gem +0 -0
- data/vendor/bundle/jruby/2.5.0/cache/webmock-3.13.0.gem +0 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/CHANGELOG.md +235 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/Gemfile +32 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/LICENSE.txt +202 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/README.md +121 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/Rakefile +34 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/data/unicode.data +0 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable.rb +4 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/idna.rb +27 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/idna/native.rb +61 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/idna/pure.rb +676 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/template.rb +1045 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/uri.rb +2529 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/lib/addressable/version.rb +32 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/idna_spec.rb +300 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/net_http_compat_spec.rb +30 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/rack_mount_compat_spec.rb +106 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/security_spec.rb +59 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/template_spec.rb +1451 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/addressable/uri_spec.rb +6603 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/spec/spec_helper.rb +24 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/clobber.rake +4 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/gem.rake +93 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/git.rake +47 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/metrics.rake +24 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/rspec.rake +23 -0
- data/vendor/bundle/jruby/2.5.0/gems/addressable-2.7.0/tasks/yard.rake +29 -0
- data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack.rb +7 -0
- data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/json.rb +98 -0
- data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/util.rb +17 -0
- data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/version.rb +3 -0
- data/vendor/bundle/jruby/2.5.0/gems/crack-0.4.5/lib/crack/xml.rb +238 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/Gemfile +8 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/LICENSE +19 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/README.md +276 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/Rakefile +18 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/changelog.md +100 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/hashdiff.gemspec +39 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff.rb +10 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/compare_hashes.rb +69 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/diff.rb +177 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/lcs.rb +66 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/lcs_compare_arrays.rb +32 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/linear_compare_array.rb +159 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/patch.rb +88 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/util.rb +155 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/lib/hashdiff/version.rb +5 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/best_diff_spec.rb +75 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/diff_array_spec.rb +60 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/diff_spec.rb +360 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/lcs_spec.rb +76 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/linear_compare_array_spec.rb +50 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/patch_spec.rb +185 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/readme_spec.rb +15 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/hashdiff/util_spec.rb +116 -0
- data/vendor/bundle/jruby/2.5.0/gems/hashdiff-1.0.1/spec/spec_helper.rb +15 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/2.0-Upgrade.md +52 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/CHANGELOG.md +406 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/Gemfile +15 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/LICENSE.txt +22 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/README.md +207 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/Rakefile +51 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/SECURITY.md +104 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/bin/console +15 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/codecov.yml +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/data/list.txt +13380 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix.rb +179 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/domain.rb +235 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/errors.rb +41 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/list.rb +247 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/rule.rb +350 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/lib/public_suffix/version.rb +13 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/public_suffix.gemspec +29 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/acceptance_test.rb +131 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find.rb +66 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_find_all.rb +102 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_names.rb +91 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_select.rb +26 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_select_incremental.rb +25 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/benchmarks/bm_valid.rb +101 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/domain_profiler.rb +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/find_profiler.rb +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/find_profiler_jp.rb +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/initialization_profiler.rb +11 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/list_profsize.rb +11 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/profilers/object_binsize.rb +57 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/psl_test.rb +52 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/test_helper.rb +18 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/tests.txt +98 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/domain_test.rb +106 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/errors_test.rb +25 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/list_test.rb +241 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/public_suffix_test.rb +188 -0
- data/vendor/bundle/jruby/2.5.0/gems/public_suffix-4.0.6/test/unit/rule_test.rb +222 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/LICENSE.txt +22 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/NEWS.md +178 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/README.md +48 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/context.rdoc +143 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/child.rdoc +87 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/document.rdoc +276 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/element.rdoc +602 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/node.rdoc +97 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/rdoc/parent.rdoc +267 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/child_toc.rdoc +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/document_toc.rdoc +30 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/element_toc.rdoc +55 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/master_toc.rdoc +135 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/node_toc.rdoc +16 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/doc/rexml/tasks/tocs/parent_toc.rdoc +25 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml.rb +3 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/attlistdecl.rb +63 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/attribute.rb +205 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/cdata.rb +68 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/child.rb +97 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/comment.rb +80 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/doctype.rb +311 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/document.rb +451 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/attlistdecl.rb +11 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/dtd.rb +47 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/elementdecl.rb +18 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/entitydecl.rb +57 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/dtd/notationdecl.rb +40 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/element.rb +2599 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/encoding.rb +51 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/entity.rb +171 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/formatters/default.rb +116 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/formatters/pretty.rb +142 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/formatters/transitive.rb +58 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/functions.rb +447 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/instruction.rb +79 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/light/node.rb +188 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/namespace.rb +59 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/node.rb +76 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/output.rb +30 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parent.rb +166 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parseexception.rb +52 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/baseparser.rb +694 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/lightparser.rb +59 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/pullparser.rb +197 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/sax2parser.rb +273 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/streamparser.rb +61 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/treeparser.rb +101 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/ultralightparser.rb +57 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/parsers/xpathparser.rb +689 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/quickpath.rb +266 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/rexml.rb +37 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/sax2listener.rb +98 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/security.rb +28 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/source.rb +298 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/streamlistener.rb +93 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/text.rb +424 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/undefinednamespaceexception.rb +9 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/validation/relaxng.rb +539 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/validation/validation.rb +144 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/validation/validationexception.rb +10 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xmldecl.rb +130 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xmltokens.rb +85 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xpath.rb +81 -0
- data/vendor/bundle/jruby/2.5.0/gems/rexml-3.2.5/lib/rexml/xpath_parser.rb +974 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/CHANGELOG.md +1894 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/Gemfile +9 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/LICENSE +20 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/README.md +1176 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/Rakefile +38 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock.rb +59 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/api.rb +109 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/assertion_failure.rb +11 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/callback_registry.rb +35 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/config.rb +18 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/cucumber.rb +10 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/deprecation.rb +9 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/errors.rb +17 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/async_http_client_adapter.rb +216 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/curb_adapter.rb +351 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +231 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/excon_adapter.rb +165 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_lib_adapter.rb +7 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_lib_adapter_registry.rb +19 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/client.rb +17 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/request.rb +16 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/response.rb +64 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/streamer.rb +29 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb/webmock.rb +68 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/http_rb_adapter.rb +37 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/httpclient_adapter.rb +259 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/manticore_adapter.rb +145 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/net_http.rb +385 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/net_http_response.rb +34 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/patron_adapter.rb +130 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb +174 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/any_arg_matcher.rb +13 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/hash_argument_matcher.rb +21 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/hash_excluding_matcher.rb +15 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/matchers/hash_including_matcher.rb +17 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/minitest.rb +41 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rack_response.rb +69 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_body_diff.rb +64 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_execution_verifier.rb +77 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_pattern.rb +405 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_registry.rb +35 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_signature.rb +54 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_signature_snippet.rb +61 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/request_stub.rb +100 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/response.rb +159 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/responses_sequence.rb +40 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec.rb +42 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec/matchers.rb +27 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec/matchers/request_pattern_matcher.rb +78 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/rspec/matchers/webmock_matcher.rb +67 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/stub_registry.rb +82 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/stub_request_snippet.rb +38 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/test_unit.rb +20 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/hash_counter.rb +39 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/hash_keys_stringifier.rb +25 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/hash_validator.rb +17 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/headers.rb +64 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/json.rb +67 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/query_mapper.rb +281 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/uri.rb +111 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/values_stringifier.rb +20 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/util/version_checker.rb +111 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/version.rb +3 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/webmock.rb +163 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/minitest/test_helper.rb +34 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/minitest/test_webmock.rb +9 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/minitest/webmock_spec.rb +60 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/async_http_client/async_http_client_spec.rb +375 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/async_http_client/async_http_client_spec_helper.rb +73 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/curb/curb_spec.rb +499 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/curb/curb_spec_helper.rb +147 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/em_http_request/em_http_request_spec.rb +462 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/em_http_request/em_http_request_spec_helper.rb +77 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/excon/excon_spec.rb +77 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/excon/excon_spec_helper.rb +52 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/http_rb/http_rb_spec.rb +93 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/http_rb/http_rb_spec_helper.rb +54 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/httpclient/httpclient_spec.rb +217 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/httpclient/httpclient_spec_helper.rb +57 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec.rb +107 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/manticore/manticore_spec_helper.rb +35 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/net_http_shared.rb +153 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/net_http_spec.rb +369 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/net_http_spec_helper.rb +64 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/net_http/real_net_http_spec.rb +20 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/patron/patron_spec.rb +125 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/patron/patron_spec_helper.rb +54 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/allowing_and_disabling_net_connect.rb +313 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/callbacks.rb +148 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/complex_cross_concern_behaviors.rb +36 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/enabling_and_disabling_webmock.rb +95 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/precedence_of_stubs.rb +15 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/request_expectations.rb +930 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/returning_declared_responses.rb +409 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/shared/stubbing_requests.rb +678 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/typhoeus/typhoeus_hydra_spec.rb +135 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/typhoeus/typhoeus_hydra_spec_helper.rb +60 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/acceptance/webmock_shared.rb +41 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/fixtures/test.txt +1 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/quality_spec.rb +84 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/spec_helper.rb +48 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/example_curl_output.txt +22 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/failures.rb +9 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/my_rack_app.rb +53 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/network_connection.rb +19 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/support/webmock_server.rb +70 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/api_spec.rb +175 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/errors_spec.rb +129 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/http_lib_adapters/http_lib_adapter_registry_spec.rb +17 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/http_lib_adapters/http_lib_adapter_spec.rb +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/matchers/hash_excluding_matcher_spec.rb +61 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/matchers/hash_including_matcher_spec.rb +87 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/rack_response_spec.rb +112 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_body_diff_spec.rb +90 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_execution_verifier_spec.rb +208 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_pattern_spec.rb +736 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_registry_spec.rb +95 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_signature_snippet_spec.rb +89 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_signature_spec.rb +155 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/request_stub_spec.rb +199 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/response_spec.rb +286 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/stub_registry_spec.rb +103 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/stub_request_snippet_spec.rb +115 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/hash_counter_spec.rb +39 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/hash_keys_stringifier_spec.rb +27 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/headers_spec.rb +28 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/json_spec.rb +33 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/query_mapper_spec.rb +157 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/uri_spec.rb +371 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/util/version_checker_spec.rb +65 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/spec/unit/webmock_spec.rb +60 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/http_request.rb +24 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/shared_test.rb +108 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/test_helper.rb +23 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/test/test_webmock.rb +12 -0
- data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/webmock.gemspec +54 -0
- data/vendor/bundle/jruby/2.5.0/specifications/addressable-2.7.0.gemspec +39 -0
- data/vendor/bundle/jruby/2.5.0/specifications/crack-0.4.5.gemspec +32 -0
- data/vendor/bundle/jruby/2.5.0/specifications/hashdiff-1.0.1.gemspec +46 -0
- data/vendor/bundle/jruby/2.5.0/specifications/public_suffix-4.0.6.gemspec +24 -0
- data/vendor/bundle/jruby/2.5.0/specifications/rexml-3.2.5.gemspec +42 -0
- data/vendor/bundle/jruby/2.5.0/specifications/webmock-3.13.0.gemspec +85 -0
- metadata +311 -4
data/vendor/bundle/jruby/2.5.0/gems/webmock-3.13.0/lib/webmock/http_lib_adapters/curb_adapter.rb
ADDED
@@ -0,0 +1,351 @@
|
|
1
|
+
begin
|
2
|
+
require 'curb'
|
3
|
+
rescue LoadError
|
4
|
+
# curb not found
|
5
|
+
end
|
6
|
+
|
7
|
+
if defined?(Curl)
|
8
|
+
WebMock::VersionChecker.new('Curb', Curl::CURB_VERSION, '0.7.16', '0.9.1', ['0.8.7']).check_version!
|
9
|
+
|
10
|
+
module WebMock
|
11
|
+
module HttpLibAdapters
|
12
|
+
class CurbAdapter < HttpLibAdapter
|
13
|
+
adapter_for :curb
|
14
|
+
|
15
|
+
OriginalCurlEasy = Curl::Easy unless const_defined?(:OriginalCurlEasy)
|
16
|
+
|
17
|
+
def self.enable!
|
18
|
+
Curl.send(:remove_const, :Easy)
|
19
|
+
Curl.send(:const_set, :Easy, Curl::WebMockCurlEasy)
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.disable!
|
23
|
+
Curl.send(:remove_const, :Easy)
|
24
|
+
Curl.send(:const_set, :Easy, OriginalCurlEasy)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Borrowed from Patron:
|
28
|
+
# http://github.com/toland/patron/blob/master/lib/patron/response.rb
|
29
|
+
def self.parse_header_string(header_string)
|
30
|
+
status, headers = nil, {}
|
31
|
+
|
32
|
+
header_string.split(/\r\n/).each do |header|
|
33
|
+
if header =~ %r|^HTTP/1.[01] \d\d\d (.*)|
|
34
|
+
status = $1
|
35
|
+
else
|
36
|
+
parts = header.split(':', 2)
|
37
|
+
unless parts.empty?
|
38
|
+
parts[1].strip! unless parts[1].nil?
|
39
|
+
if headers.has_key?(parts[0])
|
40
|
+
headers[parts[0]] = [headers[parts[0]]] unless headers[parts[0]].kind_of? Array
|
41
|
+
headers[parts[0]] << parts[1]
|
42
|
+
else
|
43
|
+
headers[parts[0]] = parts[1]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
return status, headers
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
module Curl
|
56
|
+
class WebMockCurlEasy < Curl::Easy
|
57
|
+
def curb_or_webmock
|
58
|
+
request_signature = build_request_signature
|
59
|
+
WebMock::RequestRegistry.instance.requested_signatures.put(request_signature)
|
60
|
+
|
61
|
+
if webmock_response = WebMock::StubRegistry.instance.response_for_request(request_signature)
|
62
|
+
build_curb_response(webmock_response)
|
63
|
+
WebMock::CallbackRegistry.invoke_callbacks(
|
64
|
+
{lib: :curb}, request_signature, webmock_response)
|
65
|
+
invoke_curb_callbacks
|
66
|
+
true
|
67
|
+
elsif WebMock.net_connect_allowed?(request_signature.uri)
|
68
|
+
res = yield
|
69
|
+
if WebMock::CallbackRegistry.any_callbacks?
|
70
|
+
webmock_response = build_webmock_response
|
71
|
+
WebMock::CallbackRegistry.invoke_callbacks(
|
72
|
+
{lib: :curb, real_request: true}, request_signature,
|
73
|
+
webmock_response)
|
74
|
+
end
|
75
|
+
res
|
76
|
+
else
|
77
|
+
raise WebMock::NetConnectNotAllowedError.new(request_signature)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def build_request_signature
|
82
|
+
method = @webmock_method.to_s.downcase.to_sym
|
83
|
+
|
84
|
+
uri = WebMock::Util::URI.heuristic_parse(self.url)
|
85
|
+
uri.path = uri.normalized_path.gsub("[^:]//","/")
|
86
|
+
|
87
|
+
headers = headers_as_hash(self.headers).merge(basic_auth_headers)
|
88
|
+
|
89
|
+
request_body = case method
|
90
|
+
when :post, :patch
|
91
|
+
self.post_body || @post_body
|
92
|
+
when :put
|
93
|
+
@put_data
|
94
|
+
else
|
95
|
+
nil
|
96
|
+
end
|
97
|
+
|
98
|
+
if defined?( @on_debug )
|
99
|
+
@on_debug.call("Trying 127.0.0.1...\r\n", 0)
|
100
|
+
@on_debug.call('Connected to ' + uri.hostname + "\r\n", 0)
|
101
|
+
@debug_method = method.upcase
|
102
|
+
@debug_path = uri.path
|
103
|
+
@debug_host = uri.hostname
|
104
|
+
http_request = ["#{@debug_method} #{@debug_path} HTTP/1.1"]
|
105
|
+
http_request << "Host: #{uri.hostname}"
|
106
|
+
headers.each do |name, value|
|
107
|
+
http_request << "#{name}: #{value}"
|
108
|
+
end
|
109
|
+
@on_debug.call(http_request.join("\r\n") + "\r\n\r\n", 2)
|
110
|
+
if request_body
|
111
|
+
@on_debug.call(request_body + "\r\n", 4)
|
112
|
+
@on_debug.call(
|
113
|
+
"upload completely sent off: #{request_body.bytesize}"\
|
114
|
+
" out of #{request_body.bytesize} bytes\r\n", 0
|
115
|
+
)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
request_signature = WebMock::RequestSignature.new(
|
120
|
+
method,
|
121
|
+
uri.to_s,
|
122
|
+
body: request_body,
|
123
|
+
headers: headers
|
124
|
+
)
|
125
|
+
request_signature
|
126
|
+
end
|
127
|
+
|
128
|
+
def headers_as_hash(headers)
|
129
|
+
if headers.is_a?(Array)
|
130
|
+
headers.inject({}) {|hash, header|
|
131
|
+
name, value = header.split(":").map(&:strip)
|
132
|
+
hash[name] = value
|
133
|
+
hash
|
134
|
+
}
|
135
|
+
else
|
136
|
+
headers
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
def basic_auth_headers
|
141
|
+
if self.username
|
142
|
+
{'Authorization' => WebMock::Util::Headers.basic_auth_header(self.username, self.password)}
|
143
|
+
else
|
144
|
+
{}
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
def build_curb_response(webmock_response)
|
149
|
+
raise Curl::Err::TimeoutError if webmock_response.should_timeout
|
150
|
+
webmock_response.raise_error_if_any
|
151
|
+
|
152
|
+
@body_str = webmock_response.body
|
153
|
+
@response_code = webmock_response.status[0]
|
154
|
+
|
155
|
+
@header_str = "HTTP/1.1 #{webmock_response.status[0]} #{webmock_response.status[1]}\r\n".dup
|
156
|
+
|
157
|
+
@on_debug.call(@header_str, 1) if defined?( @on_debug )
|
158
|
+
|
159
|
+
if webmock_response.headers
|
160
|
+
@header_str << webmock_response.headers.map do |k,v|
|
161
|
+
header = "#{k}: #{v.is_a?(Array) ? v.join(", ") : v}"
|
162
|
+
@on_debug.call(header + "\r\n", 1) if defined?( @on_debug )
|
163
|
+
header
|
164
|
+
end.join("\r\n")
|
165
|
+
@on_debug.call("\r\n", 1) if defined?( @on_debug )
|
166
|
+
|
167
|
+
location = webmock_response.headers['Location']
|
168
|
+
if self.follow_location? && location
|
169
|
+
@last_effective_url = location
|
170
|
+
webmock_follow_location(location)
|
171
|
+
end
|
172
|
+
|
173
|
+
@content_type = webmock_response.headers["Content-Type"]
|
174
|
+
@transfer_encoding = webmock_response.headers["Transfer-Encoding"]
|
175
|
+
end
|
176
|
+
|
177
|
+
@last_effective_url ||= self.url
|
178
|
+
end
|
179
|
+
|
180
|
+
def webmock_follow_location(location)
|
181
|
+
first_url = self.url
|
182
|
+
self.url = location
|
183
|
+
|
184
|
+
curb_or_webmock do
|
185
|
+
send( :http, {'method' => @webmock_method} )
|
186
|
+
end
|
187
|
+
|
188
|
+
self.url = first_url
|
189
|
+
end
|
190
|
+
|
191
|
+
def invoke_curb_callbacks
|
192
|
+
@on_progress.call(0.0,1.0,0.0,1.0) if defined?( @on_progress )
|
193
|
+
self.header_str.lines.each { |header_line| @on_header.call header_line } if defined?( @on_header )
|
194
|
+
if defined?( @on_body )
|
195
|
+
if chunked_response?
|
196
|
+
self.body_str.each do |chunk|
|
197
|
+
@on_body.call(chunk)
|
198
|
+
end
|
199
|
+
else
|
200
|
+
@on_body.call(self.body_str)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
@on_complete.call(self) if defined?( @on_complete )
|
204
|
+
|
205
|
+
case response_code
|
206
|
+
when 200..299
|
207
|
+
@on_success.call(self) if defined?( @on_success )
|
208
|
+
when 400..499
|
209
|
+
@on_missing.call(self, self.response_code) if defined?( @on_missing )
|
210
|
+
when 500..599
|
211
|
+
@on_failure.call(self, self.response_code) if defined?( @on_failure )
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
def chunked_response?
|
216
|
+
defined?( @transfer_encoding ) && @transfer_encoding == 'chunked' && self.body_str.respond_to?(:each)
|
217
|
+
end
|
218
|
+
|
219
|
+
def build_webmock_response
|
220
|
+
status, headers =
|
221
|
+
WebMock::HttpLibAdapters::CurbAdapter.parse_header_string(self.header_str)
|
222
|
+
|
223
|
+
if defined?( @on_debug )
|
224
|
+
http_response = ["HTTP/1.0 #{@debug_method} #{@debug_path}"]
|
225
|
+
headers.each do |name, value|
|
226
|
+
http_response << "#{name}: #{value}"
|
227
|
+
end
|
228
|
+
http_response << self.body_str
|
229
|
+
@on_debug.call(http_response.join("\r\n") + "\r\n", 3)
|
230
|
+
@on_debug.call("Connection #0 to host #{@debug_host} left intact\r\n", 0)
|
231
|
+
end
|
232
|
+
|
233
|
+
webmock_response = WebMock::Response.new
|
234
|
+
webmock_response.status = [self.response_code, status]
|
235
|
+
webmock_response.body = self.body_str
|
236
|
+
webmock_response.headers = headers
|
237
|
+
webmock_response
|
238
|
+
end
|
239
|
+
|
240
|
+
###
|
241
|
+
### Mocks of Curl::Easy methods below here.
|
242
|
+
###
|
243
|
+
|
244
|
+
def http(method)
|
245
|
+
@webmock_method = method
|
246
|
+
super
|
247
|
+
end
|
248
|
+
|
249
|
+
%w[ get head delete ].each do |verb|
|
250
|
+
define_method "http_#{verb}" do
|
251
|
+
@webmock_method = verb
|
252
|
+
super()
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
def http_put data = nil
|
257
|
+
@webmock_method = :put
|
258
|
+
@put_data = data if data
|
259
|
+
super
|
260
|
+
end
|
261
|
+
alias put http_put
|
262
|
+
|
263
|
+
def http_post *data
|
264
|
+
@webmock_method = :post
|
265
|
+
@post_body = data.join('&') if data && !data.empty?
|
266
|
+
super
|
267
|
+
end
|
268
|
+
alias post http_post
|
269
|
+
|
270
|
+
def perform
|
271
|
+
@webmock_method ||= :get
|
272
|
+
curb_or_webmock { super }
|
273
|
+
ensure
|
274
|
+
reset_webmock_method
|
275
|
+
end
|
276
|
+
|
277
|
+
def put_data= data
|
278
|
+
@webmock_method = :put
|
279
|
+
@put_data = data
|
280
|
+
super
|
281
|
+
end
|
282
|
+
|
283
|
+
def post_body= data
|
284
|
+
@webmock_method = :post
|
285
|
+
super
|
286
|
+
end
|
287
|
+
|
288
|
+
def delete= value
|
289
|
+
@webmock_method = :delete if value
|
290
|
+
super
|
291
|
+
end
|
292
|
+
|
293
|
+
def head= value
|
294
|
+
@webmock_method = :head if value
|
295
|
+
super
|
296
|
+
end
|
297
|
+
|
298
|
+
def verbose=(verbose)
|
299
|
+
@verbose = verbose
|
300
|
+
end
|
301
|
+
|
302
|
+
def verbose?
|
303
|
+
@verbose ||= false
|
304
|
+
end
|
305
|
+
|
306
|
+
def body_str
|
307
|
+
@body_str ||= super
|
308
|
+
end
|
309
|
+
alias body body_str
|
310
|
+
|
311
|
+
def response_code
|
312
|
+
@response_code ||= super
|
313
|
+
end
|
314
|
+
|
315
|
+
def header_str
|
316
|
+
@header_str ||= super
|
317
|
+
end
|
318
|
+
alias head header_str
|
319
|
+
|
320
|
+
def last_effective_url
|
321
|
+
@last_effective_url ||= super
|
322
|
+
end
|
323
|
+
|
324
|
+
def content_type
|
325
|
+
@content_type ||= super
|
326
|
+
end
|
327
|
+
|
328
|
+
%w[ success failure missing header body complete progress debug ].each do |callback|
|
329
|
+
class_eval <<-METHOD, __FILE__, __LINE__
|
330
|
+
def on_#{callback} &block
|
331
|
+
@on_#{callback} = block
|
332
|
+
super
|
333
|
+
end
|
334
|
+
METHOD
|
335
|
+
end
|
336
|
+
|
337
|
+
def reset_webmock_method
|
338
|
+
@webmock_method = :get
|
339
|
+
end
|
340
|
+
|
341
|
+
def reset
|
342
|
+
instance_variable_set(:@body_str, nil)
|
343
|
+
instance_variable_set(:@content_type, nil)
|
344
|
+
instance_variable_set(:@header_str, nil)
|
345
|
+
instance_variable_set(:@last_effective_url, nil)
|
346
|
+
instance_variable_set(:@response_code, nil)
|
347
|
+
super
|
348
|
+
end
|
349
|
+
end
|
350
|
+
end
|
351
|
+
end
|
@@ -0,0 +1,231 @@
|
|
1
|
+
begin
|
2
|
+
require 'em-http-request'
|
3
|
+
rescue LoadError
|
4
|
+
# em-http-request not found
|
5
|
+
end
|
6
|
+
|
7
|
+
if defined?(EventMachine::HttpClient)
|
8
|
+
module WebMock
|
9
|
+
module HttpLibAdapters
|
10
|
+
class EmHttpRequestAdapter < HttpLibAdapter
|
11
|
+
adapter_for :em_http_request
|
12
|
+
|
13
|
+
OriginalHttpClient = EventMachine::HttpClient unless const_defined?(:OriginalHttpClient)
|
14
|
+
OriginalHttpConnection = EventMachine::HttpConnection unless const_defined?(:OriginalHttpConnection)
|
15
|
+
|
16
|
+
def self.enable!
|
17
|
+
EventMachine.send(:remove_const, :HttpConnection)
|
18
|
+
EventMachine.send(:const_set, :HttpConnection, EventMachine::WebMockHttpConnection)
|
19
|
+
EventMachine.send(:remove_const, :HttpClient)
|
20
|
+
EventMachine.send(:const_set, :HttpClient, EventMachine::WebMockHttpClient)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.disable!
|
24
|
+
EventMachine.send(:remove_const, :HttpConnection)
|
25
|
+
EventMachine.send(:const_set, :HttpConnection, OriginalHttpConnection)
|
26
|
+
EventMachine.send(:remove_const, :HttpClient)
|
27
|
+
EventMachine.send(:const_set, :HttpClient, OriginalHttpClient)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
module EventMachine
|
34
|
+
if defined?(Synchrony) && HTTPMethods.instance_methods.include?(:aget)
|
35
|
+
# have to make the callbacks fire on the next tick in order
|
36
|
+
# to avoid the dreaded "double resume" exception
|
37
|
+
module HTTPMethods
|
38
|
+
%w[get head post delete put].each do |type|
|
39
|
+
class_eval %[
|
40
|
+
def #{type}(options = {}, &blk)
|
41
|
+
f = Fiber.current
|
42
|
+
|
43
|
+
conn = setup_request(:#{type}, options, &blk)
|
44
|
+
conn.callback { EM.next_tick { f.resume(conn) } }
|
45
|
+
conn.errback { EM.next_tick { f.resume(conn) } }
|
46
|
+
|
47
|
+
Fiber.yield
|
48
|
+
end
|
49
|
+
]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
class WebMockHttpConnection < HttpConnection
|
55
|
+
def activate_connection(client)
|
56
|
+
request_signature = client.request_signature
|
57
|
+
|
58
|
+
if client.stubbed_webmock_response
|
59
|
+
conn = HttpStubConnection.new rand(10000)
|
60
|
+
post_init
|
61
|
+
|
62
|
+
@deferred = false
|
63
|
+
@conn = conn
|
64
|
+
|
65
|
+
conn.parent = self
|
66
|
+
conn.pending_connect_timeout = @connopts.connect_timeout
|
67
|
+
conn.comm_inactivity_timeout = @connopts.inactivity_timeout
|
68
|
+
|
69
|
+
finalize_request(client)
|
70
|
+
@conn.set_deferred_status :succeeded
|
71
|
+
elsif WebMock.net_connect_allowed?(request_signature.uri)
|
72
|
+
super
|
73
|
+
else
|
74
|
+
raise WebMock::NetConnectNotAllowedError.new(request_signature)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def drop_client
|
79
|
+
@clients.shift
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
class WebMockHttpClient < EventMachine::HttpClient
|
84
|
+
include HttpEncoding
|
85
|
+
|
86
|
+
def uri
|
87
|
+
@req.uri
|
88
|
+
end
|
89
|
+
|
90
|
+
def setup(response, uri, error = nil)
|
91
|
+
@last_effective_url = @uri = uri
|
92
|
+
if error
|
93
|
+
on_error(error)
|
94
|
+
@conn.drop_client
|
95
|
+
fail(self)
|
96
|
+
else
|
97
|
+
@conn.receive_data(response)
|
98
|
+
succeed(self)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def connection_completed
|
103
|
+
@state = :response_header
|
104
|
+
send_request(request_signature.headers, request_signature.body)
|
105
|
+
end
|
106
|
+
|
107
|
+
def send_request(head, body)
|
108
|
+
WebMock::RequestRegistry.instance.requested_signatures.put(request_signature)
|
109
|
+
|
110
|
+
if stubbed_webmock_response
|
111
|
+
WebMock::CallbackRegistry.invoke_callbacks({lib: :em_http_request}, request_signature, stubbed_webmock_response)
|
112
|
+
@uri ||= nil
|
113
|
+
EM.next_tick {
|
114
|
+
setup(make_raw_response(stubbed_webmock_response), @uri,
|
115
|
+
stubbed_webmock_response.should_timeout ? Errno::ETIMEDOUT : nil)
|
116
|
+
}
|
117
|
+
self
|
118
|
+
elsif WebMock.net_connect_allowed?(request_signature.uri)
|
119
|
+
super
|
120
|
+
else
|
121
|
+
raise WebMock::NetConnectNotAllowedError.new(request_signature)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def unbind(reason = nil)
|
126
|
+
if !stubbed_webmock_response && WebMock::CallbackRegistry.any_callbacks?
|
127
|
+
webmock_response = build_webmock_response
|
128
|
+
WebMock::CallbackRegistry.invoke_callbacks(
|
129
|
+
{lib: :em_http_request, real_request: true},
|
130
|
+
request_signature,
|
131
|
+
webmock_response)
|
132
|
+
end
|
133
|
+
@request_signature = nil
|
134
|
+
remove_instance_variable(:@stubbed_webmock_response)
|
135
|
+
|
136
|
+
super
|
137
|
+
end
|
138
|
+
|
139
|
+
def request_signature
|
140
|
+
@request_signature ||= build_request_signature
|
141
|
+
end
|
142
|
+
|
143
|
+
def stubbed_webmock_response
|
144
|
+
unless defined?(@stubbed_webmock_response)
|
145
|
+
@stubbed_webmock_response = WebMock::StubRegistry.instance.response_for_request(request_signature)
|
146
|
+
end
|
147
|
+
|
148
|
+
@stubbed_webmock_response
|
149
|
+
end
|
150
|
+
|
151
|
+
def get_response_cookie(name)
|
152
|
+
name = name.to_s
|
153
|
+
|
154
|
+
raw_cookie = response_header.cookie
|
155
|
+
raw_cookie = [raw_cookie] if raw_cookie.is_a? String
|
156
|
+
|
157
|
+
cookie = raw_cookie.select { |c| c.start_with? name }.first
|
158
|
+
cookie and cookie.split('=', 2)[1]
|
159
|
+
end
|
160
|
+
|
161
|
+
private
|
162
|
+
|
163
|
+
def build_webmock_response
|
164
|
+
webmock_response = WebMock::Response.new
|
165
|
+
webmock_response.status = [response_header.status, response_header.http_reason]
|
166
|
+
webmock_response.headers = response_header
|
167
|
+
webmock_response.body = response
|
168
|
+
webmock_response
|
169
|
+
end
|
170
|
+
|
171
|
+
def build_request_signature
|
172
|
+
headers, body = build_request, @req.body
|
173
|
+
|
174
|
+
@conn.middleware.select {|m| m.respond_to?(:request) }.each do |m|
|
175
|
+
headers, body = m.request(self, headers, body)
|
176
|
+
end
|
177
|
+
|
178
|
+
method = @req.method
|
179
|
+
uri = @req.uri.clone
|
180
|
+
query = @req.query
|
181
|
+
|
182
|
+
uri.query = encode_query(@req.uri, query).slice(/\?(.*)/, 1)
|
183
|
+
|
184
|
+
body = form_encode_body(body) if body.is_a?(Hash)
|
185
|
+
|
186
|
+
if headers['authorization'] && headers['authorization'].is_a?(Array)
|
187
|
+
headers['Authorization'] = WebMock::Util::Headers.basic_auth_header(headers.delete('authorization'))
|
188
|
+
end
|
189
|
+
|
190
|
+
WebMock::RequestSignature.new(
|
191
|
+
method.downcase.to_sym,
|
192
|
+
uri.to_s,
|
193
|
+
body: body || (@req.file && File.read(@req.file)),
|
194
|
+
headers: headers
|
195
|
+
)
|
196
|
+
end
|
197
|
+
|
198
|
+
def make_raw_response(response)
|
199
|
+
response.raise_error_if_any
|
200
|
+
|
201
|
+
status, headers, body = response.status, response.headers, response.body
|
202
|
+
headers ||= {}
|
203
|
+
|
204
|
+
response_string = []
|
205
|
+
response_string << "HTTP/1.1 #{status[0]} #{status[1]}"
|
206
|
+
|
207
|
+
headers["Content-Length"] = body.bytesize unless headers["Content-Length"]
|
208
|
+
headers.each do |header, value|
|
209
|
+
if header =~ /set-cookie/i
|
210
|
+
[value].flatten.each do |cookie|
|
211
|
+
response_string << "#{header}: #{cookie}"
|
212
|
+
end
|
213
|
+
else
|
214
|
+
value = value.join(", ") if value.is_a?(Array)
|
215
|
+
|
216
|
+
# WebMock's internal processing will not handle the body
|
217
|
+
# correctly if the header indicates that it is chunked, unless
|
218
|
+
# we also create all the chunks.
|
219
|
+
# It's far easier just to remove the header.
|
220
|
+
next if header =~ /transfer-encoding/i && value =~/chunked/i
|
221
|
+
|
222
|
+
response_string << "#{header}: #{value}"
|
223
|
+
end
|
224
|
+
end if headers
|
225
|
+
|
226
|
+
response_string << "" << body
|
227
|
+
response_string.join("\n")
|
228
|
+
end
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|