1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Rack::OnePiece

Discussion in 'Random' started by sbagmeijer, May 23, 2015.

  1. sbagmeijer

    sbagmeijer Machine

    A while back I found this funny piece of code for ruby applications that adds an "X-Chuck-Norris" header to all your site requests.

    I changed the coding to make it so that it adds an "X-One-Piece" header to every request with One Piece qoutes.

    You can download it from my Github at:
    https://github.com/sbagmeijer/rack-OnePiece

    Information Rack::OnePiece:
    Insert X-One-Piece header with a random quote from One Piece into your rack app!

    What?:
    This project is a stupid simple rack middleware that will inject a header with random One Piece quote into every response.

    [​IMG]

    Get It:
    Code:
    gem "rack-OnePiece"
    Run it:
    In your fabulous config.ru add some stuff:
    Code:
    require "rack/OnePiece"
    use Rack::OnePiece
    
    See It:
    Curl your app:
    Code:
    curl -i http://localhost:5000
    Here we go:
    Code:
    HTTP/1.1 200
    X-One-Piece: "I'm gonna be the Pirate King." ~Monkey D. Luffy
    
    Feel free to provide more quotes by updating the following file:
    https://github.com/sbagmeijer/rack-OnePiece/blob/master/lib/rack/OnePiece/One-Piece-Quotes.txt
     

Share This Page