Skip to content

affected/package: http #59759

Closed as not planned
Closed as not planned
@js10x

Description

@js10x

What version of Go are you using (go version)?

1.20.3, but it's reproducible in earlier versions.

$ go version

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

Windows AMD64

go env Output
$ go env
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=`omitted`
set GOCACHE=`omitted`
set GOENV=`omitted`
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=`omitted`
set GONOPROXY=`omitted`
set GONOSUMDB=`omitted`
set GOOS=windows
set GOPATH=`omitted`
set GOPRIVATE=`omitted`
set GOPROXY=`omitted`
set GOROOT=`omitted`
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=`omitted`
set GOVCS=
set GOVERSION=go1.20.3
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=`omitted`
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config

What did you do?

When consuming http.NewRequest(..), I passed the word "pancakes" to the NewRequest method parameter.

What did you expect to see?

I'd expect to see an error returned when passing an invalid method as the httpMethod parameter to the function.

req, err := http.NewRequest("pancakes", "some-url", nil)
err should NOT be nil with the above usage. Seems to be a bug in the Go source here:
https://cs.opensource.google/go/go/+/refs/tags/go1.20.3:src/net/http/request.go;l=835

What did you see instead?

Error is not returned by the function, instead it marks the request as valid.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions