• With issues:
  • Use the search tool before opening a new issue.
  • Please provide source code and commit sha if you found a bug.
  • Review existing issues and provide feedback or react to them.

Description

How to reproduce

package main

import (
    "github.com/gin-gonic/gin"
)

func main() {
    g := gin.Default()
    g.GET("/hello/:name", func(c *gin.Context) {
        c.String(200, "Hello %s", c.Param("name"))
    })
    g.Run(":9000")
}

Expectations

$ curl http://localhost:8201/hello/world
Hello world

Actual result

$ curl -i http://localhost:8201/hello/world
<YOUR RESULT>

Environment

  • go version:
  • gin version (or commit ref):
  • operating system:

Comment From: ghost

I guess there is a port mismatch , in the code you provided 9000 as the port , but you are testing on the port 8021 ? Consider doing like this :

curl  -i http://localhost:9000/hello/world

shall provide you with Hello, world

Comment From: Kamandlou

It's definitely a port mistake. I tested this code and it worked perfectly.