Skip to content

Exported HTTP method names to avoid manual entry#353

Merged
VojtechVitek merged 3 commits into
go-chi:masterfrom
rodney-b:master
Oct 23, 2018
Merged

Exported HTTP method names to avoid manual entry#353
VojtechVitek merged 3 commits into
go-chi:masterfrom
rodney-b:master

Conversation

@rodney-b

Copy link
Copy Markdown
Contributor

Added exported http method names for use when calling functions that require manually entering the method name such as Method and MethodFunc to avoid syntax errors plus it defines which methods are supported. Also avoid having devs create their own method constants.

Used all caps for the names to avoid conflicts with the existing exported functions with the same names.

@VojtechVitek VojtechVitek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use https://golang.org/pkg/net/http/#pkg-constants.

No need to redefine these constants within https://github.com/go-chi/chi

@rodney-b

Copy link
Copy Markdown
Contributor Author

Agreed. Good to know about those.

@rodney-b

Copy link
Copy Markdown
Contributor Author

Anything else?

1 similar comment
@rodney-b

Copy link
Copy Markdown
Contributor Author

Anything else?

@pkieltyka

Copy link
Copy Markdown
Member

just wondering, what's new or improved that this PR provides..?

@VojtechVitek VojtechVitek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing really (after 34b22fe).

It reuses constants defined in http pkg for method names, instead of using strings. There might be some (but very little) gain on the binary size .. few bytes.

I'm fine with squashing and merging this. It won't hurt.

@pkieltyka

Copy link
Copy Markdown
Member

sounds good, squash + merge is good with me to use stdlib constants instead of strings, cool

@VojtechVitek VojtechVitek merged commit daa22f6 into go-chi:master Oct 23, 2018
@pkieltyka

Copy link
Copy Markdown
Member

hey guys, small oversight.. we've broken support for Go 1.7 and Go 1.8 with this PR -- see https://travis-ci.org/go-chi/chi/builds/445197603

@pkieltyka

Copy link
Copy Markdown
Member

false alarm, the issue was actually with golint pkg on older versions. all good now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants