mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-15 15:45:49 -06:00
[GH-ISSUE #108] refactor http Handling #88
Labels
No labels
ai-generated
android-app
android-app
android-app
build
build
dependencies
docs
enhancement
enhancement
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
server
server
unified-push
web-app
website
🔒 security
🔥 HOT
🪲 bug
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/ntfy#88
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @genofire on GitHub (Jan 19, 2022).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/108
Please use switch instatt of a list of
else if:c83b5c6e73/server/server.go (L314)Example with expression in
case:Otherwise there are routing libraries out there, and ways: https://benhoyt.com/writings/go-routing/
I love gin-gonic not here meanthan
@binwiederhier commented on GitHub (Jan 19, 2022):
It's funny I read the post you linked before, and I chose not to do any of them. I have read and kept up with routers a lot and I think they just don't add enough value to bring them in.
As for the switch case; isn't that just a personal preference?
@genofire commented on GitHub (Jan 19, 2022):
personal preference if you call it that way ....
source code should be readable and therefore
switchwas designed ...normally switch is optimized by compiler for runtime, but i believe that is not possible in a expression in case way.
@genofire commented on GitHub (Jan 19, 2022):
You are already using an Http-Router:
c83b5c6e73/server/server.go (L232-L238)maybe you should rename :
c83b5c6e73/server/server.go (L296)to
func (s *Server) ServeHTTP(w ResponseWriter, r *Request)and direct use it.And put it
shere instatt ofmux:c83b5c6e73/server/server.go (L238)@binwiederhier commented on GitHub (Feb 5, 2022):
That would expose the ServeHTTP method to the outside, which I did not want.
Overall I am quite happy with the HTTP routing handling. I like the if/then/else the way it is. I may adjust it a little if it gets too unwieldy in the future but for now I think this is fine.
Thanks for the suggestion though. Keep them coming!