Created
January 17, 2019 20:22
-
-
Save AdamHepner/03b9addac10c47534bd3392cb0e069e1 to your computer and use it in GitHub Desktop.
Reproduction of https://github.com/go-chi/chi/issues/382
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"log" | |
"net/http" | |
"github.com/go-chi/chi/middleware" | |
"github.com/go-chi/chi" | |
"github.com/go-chi/render" | |
) | |
func main() { | |
router := chi.NewRouter() | |
router.Use(middleware.DefaultCompress) | |
router.Get("/", func(w http.ResponseWriter, r *http.Request) { | |
render.Status(r, http.StatusTeapot) | |
render.JSON(w, r, "This is it boys") | |
}) | |
log.Fatal(http.ListenAndServe(":8081", router)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected behaviour when GETting http://localhost:8081/ is to get a HTTP status 418 "I'm a teapot". Unfortunately the line 15 causes Chi to overwrite the status with 200.