• 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: bredmond5

For my environment:

go version: go version go1.19.4 darwin/amd64 gin version (or commit ref): master operating system: macOS

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

HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Date: Mon, 06 Feb 2023 00:35:44 GMT
Content-Length: 11

Hello world% 

I copy pasted your exact code. Is <YOUR RESULT> literally what your curl statement returns? Could you fill out the Environment portion of the issue request?

Additionally, make sure to curl your server on the same port as you start the server on. In this case, you started the server on port 9000, but the curl statements you shared are against port 8201