Skip to content

404 with encodings_provided sets encoding Header but doesn't encode response body #144

@Asmod4n

Description

@Asmod4n
#!/usr/bin/env ruby

require 'bundler/setup'
require 'webmachine'

class Resource < Webmachine::Resource
  def resource_exists?
    false
  end

  def encodings_provided
    { 'gzip' => :encode_gzip,
      'deflate' => :encode_deflate,
      'identity' => :encode_identity }
  end

  def to_html
    "Hello"
  end
end

Webmachine.application.routes do
  add_route ['*'], Resource
end

Webmachine.run

This is the reply

HTTP/1.1 404 Not Found 
Content-Type: text/html
Content-Encoding: gzip
Vary: Accept-Encoding
Content-Length: 213
Date: Sat, 04 Jan 2014 22:48:04 GMT
Server: Webmachine-Ruby/1.2.1 WEBrick/1.3.1 (Ruby/2.1.0/2013-12-25)
Connection: Keep-Alive

<!DOCTYPE html><html> <head><title>404 Not Found</title></head> <body><h1>404 Not Found</h1><p>The requested document was not found on this server.</p> <address>Webmachine-Ruby/1.2.1 server</address></body></html>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions