Exported HTTP method names to avoid manual entry#353
Conversation
…equire a litteral method name such as Method and MethodFunc
VojtechVitek
left a comment
There was a problem hiding this comment.
You can use https://golang.org/pkg/net/http/#pkg-constants.
No need to redefine these constants within https://github.com/go-chi/chi
|
Agreed. Good to know about those. |
|
Anything else? |
1 similar comment
|
Anything else? |
|
just wondering, what's new or improved that this PR provides..? |
VojtechVitek
left a comment
There was a problem hiding this comment.
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.
|
sounds good, squash + merge is good with me to use stdlib constants instead of strings, cool |
|
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 |
|
false alarm, the issue was actually with golint pkg on older versions. all good now |
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.