/features/handles_compressed_responses.feature

http://github.com/jnunemaker/httparty · Gherkin Specification · 40 lines · 34 code · 6 blank · 0 comment · 1 complexity · 400134d7b9b6b0de130105f613ff2d25 MD5 · raw file

  1. Feature: Handles Compressed Responses
  2. In order to save bandwidth
  3. As a developer
  4. I want to leverage Net::Http's built in transparent support for gzip and deflate content encoding
  5. Scenario: Supports deflate encoding
  6. Given a remote deflate service
  7. And the response from the service has a body of '<h1>Some HTML</h1>'
  8. And that service is accessed at the path '/deflate_service.html'
  9. When I call HTTParty#get with '/deflate_service.html'
  10. Then the return value should match '<h1>Some HTML</h1>'
  11. And it should return a response without a content-encoding
  12. Scenario: Supports gzip encoding
  13. Given a remote gzip service
  14. And the response from the service has a body of '<h1>Some HTML</h1>'
  15. And that service is accessed at the path '/gzip_service.html'
  16. When I call HTTParty#get with '/gzip_service.html'
  17. Then the return value should match '<h1>Some HTML</h1>'
  18. And it should return a response without a content-encoding
  19. Scenario: Supports gzip encoding with explicit header set
  20. Given a remote gzip service
  21. And the response from the service has a body of '<h1>Some HTML</h1>'
  22. And that service is accessed at the path '/gzip_service.html'
  23. When I set my HTTParty header 'User-Agent' to value 'Party'
  24. And I call HTTParty#get with '/gzip_service.html'
  25. Then the return value should match '<h1>Some HTML</h1>'
  26. And it should return a response without a content-encoding
  27. Scenario: Supports deflate encoding with explicit header set
  28. Given a remote deflate service
  29. And the response from the service has a body of '<h1>Some HTML</h1>'
  30. And that service is accessed at the path '/deflate_service.html'
  31. When I set my HTTParty header 'User-Agent' to value 'Party'
  32. And I call HTTParty#get with '/deflate_service.html'
  33. Then the return value should match '<h1>Some HTML</h1>'
  34. And it should return a response without a content-encoding