Skip to content

Instantly share code, notes, and snippets.

@charlespeach
Last active January 30, 2020 22:50
Show Gist options
  • Save charlespeach/fa7af677104e75ab94dbc06fb76c60cd to your computer and use it in GitHub Desktop.
Save charlespeach/fa7af677104e75ab94dbc06fb76c60cd to your computer and use it in GitHub Desktop.

Revisions

  1. charlespeach renamed this gist Jan 30, 2020. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions reject-track.md → reject-trace.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,9 @@
    `lib/reject_track.rb`
    `lib/reject_trace.rb`

    ```ruby
    module Rack

    class RejectTrack
    class RejectTrace
    def initialize(app)
    @app = app
    end
    @@ -26,5 +26,5 @@ end

    ```ruby
    config.autoload_paths += %W(#{config.root}/lib)
    config.middleware.use "RejectTrack"
    config.middleware.use "RejectTrace"
    ```
  2. charlespeach revised this gist Jan 30, 2020. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion reject-track.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    `/lib/reject_track.rb`
    `lib/reject_track.rb`

    ```ruby
    module Rack
    @@ -22,6 +22,8 @@ module Rack
    end
    ```

    `config/application.rb`

    ```ruby
    config.autoload_paths += %W(#{config.root}/lib)
    config.middleware.use "RejectTrack"
  3. charlespeach created this gist Jan 30, 2020.
    28 changes: 28 additions & 0 deletions reject-track.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    `/lib/reject_track.rb`

    ```ruby
    module Rack

    class RejectTrack
    def initialize(app)
    @app = app
    end

    def call(env)
    status, headers, body = @app.call(env)

    if env["REQUEST_METHOD"] == "TRACE"
    body.close if body.respond_to? :close
    [status, headers, []]
    else
    [status, headers, body]
    end
    end
    end
    end
    ```

    ```ruby
    config.autoload_paths += %W(#{config.root}/lib)
    config.middleware.use "RejectTrack"
    ```