-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Replace http constants with stdlib ones #1205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -128,20 +128,6 @@ type ( | |||
} | |||
) | |||
|
|||
// HTTP methods |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it break code for users? Perhaps we can mark it deprecated and drop it in a future release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If doubt anyone uses echo.Get instead of http.MethodGet.
Also it's quite easy to replace it if it becomes breaking change for someone.
This change simplifies the codebase by reusing constants from stdlib.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed it's very quick to fix, but it's used in the documentation; https://echo.labstack.com/middleware/cors.
I used those constants, rather than the stdlib ones, because of the docs. I know it's a little late, but I can't be the only one getting broken code from this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nipemgroup I have updated the docs to reflect this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed the fact that they are in the docs when I reviewed this, @vishr was right to bet on backward compatibility. I pushed a PR to address this: #1209 - adding the exported constants back.
I propose we 1st change the documentation, then we give proper notice, and then (maybe?) we remove them later.
Standard constants for methods came recently so there may be users using it. I am okay to replace it internally but let’s keep constants if just in case they people are using it.
…Sent from my iPhone
On Oct 13, 2018, at 1:05 PM, Emir Ribić ***@***.***> wrote:
@ribice commented on this pull request.
In echo.go:
> @@ -128,20 +128,6 @@ type (
}
)
-// HTTP methods
If doubt anyone uses echo.Get instead of http.MethodGet.
Also it's quite easy to replace it if it becomes breaking change for someone.
This change simplifies the codebase by reusing constants from stdlib.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I like this change, and while I value greatly backward compatibility, I also believe there is very little reason why people would use these directly. They use e.GET() & friends instead. Also, a quick search shows 0 projects using this on Github: https://github.com/search?utf8=%E2%9C%93&q=echo.Get+language%3AGo&type=Repositories&ref=advsearch&l=Go&l= Add to that, that for production one should vendor their dependencies anyway & use tests, etc. so the chances of doing real damage with this become very small. I would just suggest to change the commit message to give a little more info by itself, so that someone would know how to fix things if they break, from the commit message alone (though the diff itself is self explanatory):
|
@alexaandru Sounds good, @ribice do you want to fix the commit message? |
Will do tomorrow. |
Done, also fixed conflicts. |
@ribice Can you fix the build? Looks like |
Codecov Report
@@ Coverage Diff @@
## master #1205 +/- ##
=======================================
Coverage 81.61% 81.61%
=======================================
Files 27 27
Lines 1931 1931
=======================================
Hits 1576 1576
Misses 248 248
Partials 107 107
Continue to review full report at Codecov.
|
Fixed. |
Signed-off-by: Vishal Rana <vr@labstack.com>
Resolves #1190