0.0
No commit activity in last 3 years
No release in over 3 years
Trims whitespace from response bodies sent through rack.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0

Runtime

~> 1.4.5
 Project Readme

Rack::Stripper: not as sexy as it sounds

Rack::Stripper merely performs String#strip on the body of the response. I wrote this out of a need for this when Rails sends out RSS feeds (for some reason, the XML instruction is replaced with a blank line on outgoing RSS responses).

Installation

Add this line to your application's Gemfile and bundle install it:

gem 'rack-stripper'

Rack::Stripper is Rack middleware and can be used with any Rack-based application. In config/application.rb, place the following code.

config.middleware.use Rack::Stripper

Then you'll see Rack::Stripper when you run rake middleware. Simple as that. More info about using Rack middleware with Rails can be found here. If you'd like the middleware to ensure an XML instruction is added to the bodies to XML-based responses, make that line look like this.

config.middleware.use Rack::Stripper, add_xml_instruction: true

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Copyright

I made this. I released it under the WTFPL. See LICENSE for details, if you're into that sort of thing.