Skip to content

net/ghttp: MiddlewareHandlerResponse writes additional information #4108

@wlynxg

Description

@wlynxg

Go version

go version go1.20.6 linux/amd64

GoFrame version

v2.8.3

Can this bug be reproduced with the latest release?

Option Yes

What did you do?

package main

import (
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/net/ghttp"
)

func main() {
	s := g.Server()
	s.Use(ghttp.MiddlewareHandlerResponse)
	s.BindHandler("/", func(r *ghttp.Request) {
		r.Response.Writer.Write([]byte("hello world"))
	})
	s.SetPort(8081)
	s.Run()
}

What did you see happen?

response: hello world{"code":0,"message":"","data":null}

What did you expect to see?

Before 2.7.0, it was: hello world

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIt is confirmed a bug, but don't worry, we'll handle it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions