{"action":"opened","issue":{"url":"https://api.github.com/repos/labstack/echo/issues/437","repository_url":"https://api.github.com/repos/labstack/echo","labels_url":"https://api.github.com/repos/labstack/echo/issues/437/labels{/name}","comments_url":"https://api.github.com/repos/labstack/echo/issues/437/comments","events_url":"https://api.github.com/repos/labstack/echo/issues/437/events","html_url":"https://github.com/labstack/echo/issues/437","id":144485244,"number":437,"title":"Problem about middleware.Gzip()","user":{"login":"NateLing","id":9606668,"avatar_url":"https://avatars.githubusercontent.com/u/9606668?v=3","gravatar_id":"","url":"https://api.github.com/users/NateLing","html_url":"https://github.com/NateLing","followers_url":"https://api.github.com/users/NateLing/followers","following_url":"https://api.github.com/users/NateLing/following{/other_user}","gists_url":"https://api.github.com/users/NateLing/gists{/gist_id}","starred_url":"https://api.github.com/users/NateLing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NateLing/subscriptions","organizations_url":"https://api.github.com/users/NateLing/orgs","repos_url":"https://api.github.com/users/NateLing/repos","events_url":"https://api.github.com/users/NateLing/events{/privacy}","received_events_url":"https://api.github.com/users/NateLing/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-30T07:21:08Z","updated_at":"2016-03-30T07:21:08Z","closed_at":null,"body":"\r\n\r\nIf i use middleware.Gzip(), i cant enter index.html.Firefox show me the server response bad format.\r\nthis is my code:\r\n\r\n```Go\r\npackage main\r\n\r\nimport (\r\n\t\"github.com/labstack/echo\"\r\n\t\"github.com/labstack/echo/engine/standard\"\r\n\t\"github.com/labstack/echo/middleware\"\r\n\t\"github.com/rs/cors\"\r\n\t\"golang.org/x/net/websocket\"\r\n\t\"lim/router\"\r\n\t\"runtime\"\r\n)\r\n\r\nfunc main() {\r\n\truntime.GOMAXPROCS(runtime.NumCPU())\r\n\r\n\t// Echo instance\r\n\techo := echo.New()\r\n\r\n\t// Middleware\r\n\techo.Use(middleware.Logger())\r\n\t//echo.Use(middleware.Gzip())\r\n\techo.Use(middleware.Recover())\r\n\techo.Use(middleware.Static(\"public\"))\r\n\r\n\t// CORS\r\n\techo.Use(standard.WrapMiddleware(cors.New(cors.Options{\r\n\t\tAllowedOrigins: []string{\"http://localhost\"},\r\n\t}).Handler))\r\n\r\n\t// Websocket\r\n\techo.Get(\"/ws\", standard.WrapHandler(websocket.Handler(func(ws *websocket.Conn) {\r\n\t\tfor {\r\n\t\t\twebsocket.Message.Send(ws, \"Hello, Client!\")\r\n\t\t\tmsg := \"\"\r\n\t\t\twebsocket.Message.Receive(ws, &msg)\r\n\t\t\tprintln(msg)\r\n\t\t}\r\n\t})))\r\n\r\n\trouter.AppRouter(echo)\r\n\r\n\techo.Run(standard.New(\":80\"))\r\n}\r\n\r\n```\r\n\r\n```Go\r\npackage router\r\n\r\nimport (\r\n\t\"github.com/labstack/echo\"\r\n\t\"net/http\"\r\n\t\"strconv\"\r\n)\r\n\r\nfunc HTTPErrorHandler() echo.HTTPErrorHandler {\r\n\tdata := &RData{}\r\n\treturn func(err error, c echo.Context) {\r\n\t\tcode := http.StatusInternalServerError\r\n\t\tpage := \"\"\r\n\t\tif he, ok := err.(*echo.HTTPError); ok {\r\n\t\t\tcode = he.Code\r\n\t\t}\r\n\t\tdata.Title = strconv.Itoa(code)\r\n\t\tswitch code {\r\n\t\tcase 404:\r\n\t\t\tpage = \"404\"\r\n\t\t\tbreak\r\n\t\tcase 502:\r\n\t\t\tpage = \"502\"\r\n\t\t\tbreak\r\n\t\tdefault:\r\n\t\t\tpage = \"error\"\r\n\t\t\tbreak\r\n\t\t}\r\n\t\tHTML(c, page, data)\r\n\t}\r\n}\r\n\r\nfunc AppRouter(echo *echo.Echo) {\r\n\techo.Get(\"/\", Index())\r\n\r\n\t// Error handler\r\n\techo.SetHTTPErrorHandler(HTTPErrorHandler())\r\n}\r\n\r\n```\r\n\r\n```Go\r\npackage router\r\n\r\nimport (\r\n\t\"github.com/labstack/echo\"\r\n\t\"github.com/labstack/echo/engine/standard\"\r\n\t\"github.com/unrolled/render\"\r\n\t\"html/template\"\r\n\t\"net/http\"\r\n)\r\n\r\ntype RData struct {\r\n\tTitle string\r\n}\r\n\r\nvar Render = render.New(render.Options{\r\n\tDirectory:                 \"templates\",                                      // Specify what path to load the templates from.\r\n\tLayout:                    \"layout/default\",                                 // Specify a layout template. Layouts can call {{ yield }} to render the current template or {{ partial \"css\" }} to render a partial from the current template.\r\n\tExtensions:                []string{\".tmpl\", \".html\"},                       // Specify extensions to load for templates.\r\n\tFuncs:                     []template.FuncMap{},                             // Specify helper function maps for templates to access.\r\n\tDelims:                    render.Delims{\"{{\", \"}}\"},                        // Sets delimiters to the specified strings.\r\n\tCharset:                   \"UTF-8\",                                          // Sets encoding for json and html content-types. Default is \"UTF-8\".\r\n\tIndentJSON:                true,                                             // Output human readable JSON.\r\n\tIndentXML:                 true,                                             // Output human readable XML.\r\n\tPrefixJSON:                []byte(\")]}',\\n\"),                                // Prefixes JSON responses with the given bytes.\r\n\tPrefixXML:                 []byte(\"<?xml version='1.0' encoding='UTF-8'?>\"), // Prefixes XML responses with the given bytes.\r\n\tHTMLContentType:           \"text/html\",                                      // Output XHTML content type instead of default \"text/html\".\r\n\tIsDevelopment:             false,                                            // Render will now recompile the templates on every HTML response.\r\n\tUnEscapeHTML:              true,                                             // Replace ensure '&<>' are output correctly (JSON only).\r\n\tStreamingJSON:             true,                                             // Streams the JSON response via json.Encoder.\r\n\tRequirePartials:           true,                                             // Return an error if a template is missing a partial used in a layout.\r\n\tDisableHTTPErrorRendering: false,                                            // Disables automatic rendering of http.StatusInternalServerError when an error occurs.\r\n})\r\n\r\n// HTML builds up the response from the specified template and bindings.\r\nfunc HTML(c echo.Context, name string, binding interface{}, htmlOpt ...render.HTMLOptions) error {\r\n\t// `http.ResponseWriter`\r\n\tw := c.Response().(*standard.Response).ResponseWriter\r\n\treturn Render.HTML(w, http.StatusOK, name, binding, htmlOpt...)\r\n}\r\n```\r\n\r\n```Go\r\npackage router\r\n\r\nimport (\r\n\t\"github.com/labstack/echo\"\r\n)\r\n\r\nfunc Index() echo.HandlerFunc {\r\n\tdata := &RData{\r\n\t\tTitle: \"Index\",\r\n\t}\r\n\treturn func(c echo.Context) error {\r\n\t\treturn HTML(c, \"index\", data)\r\n\t}\r\n}\r\n\r\n```\r\n"}}