mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
Use stdlib constants for HTTP methods instead of strings
This commit is contained in:
parent
ec18abc97f
commit
8304666261
3 changed files with 109 additions and 107 deletions
60
api/api.go
60
api/api.go
|
@ -5,6 +5,8 @@
|
|||
package api // import "miniflux.app/api"
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"miniflux.app/reader/feed"
|
||||
"miniflux.app/storage"
|
||||
"miniflux.app/worker"
|
||||
|
@ -21,33 +23,33 @@ func Serve(router *mux.Router, store *storage.Storage, pool *worker.Pool, feedHa
|
|||
sr.Use(middleware.handleCORS)
|
||||
sr.Use(middleware.apiKeyAuth)
|
||||
sr.Use(middleware.basicAuth)
|
||||
sr.Methods("OPTIONS")
|
||||
sr.HandleFunc("/users", handler.createUser).Methods("POST")
|
||||
sr.HandleFunc("/users", handler.users).Methods("GET")
|
||||
sr.HandleFunc("/users/{userID:[0-9]+}", handler.userByID).Methods("GET")
|
||||
sr.HandleFunc("/users/{userID:[0-9]+}", handler.updateUser).Methods("PUT")
|
||||
sr.HandleFunc("/users/{userID:[0-9]+}", handler.removeUser).Methods("DELETE")
|
||||
sr.HandleFunc("/users/{username}", handler.userByUsername).Methods("GET")
|
||||
sr.HandleFunc("/me", handler.currentUser).Methods("GET")
|
||||
sr.HandleFunc("/categories", handler.createCategory).Methods("POST")
|
||||
sr.HandleFunc("/categories", handler.getCategories).Methods("GET")
|
||||
sr.HandleFunc("/categories/{categoryID}", handler.updateCategory).Methods("PUT")
|
||||
sr.HandleFunc("/categories/{categoryID}", handler.removeCategory).Methods("DELETE")
|
||||
sr.HandleFunc("/discover", handler.getSubscriptions).Methods("POST")
|
||||
sr.HandleFunc("/feeds", handler.createFeed).Methods("POST")
|
||||
sr.HandleFunc("/feeds", handler.getFeeds).Methods("GET")
|
||||
sr.HandleFunc("/feeds/refresh", handler.refreshAllFeeds).Methods("PUT")
|
||||
sr.HandleFunc("/feeds/{feedID}/refresh", handler.refreshFeed).Methods("PUT")
|
||||
sr.HandleFunc("/feeds/{feedID}", handler.getFeed).Methods("GET")
|
||||
sr.HandleFunc("/feeds/{feedID}", handler.updateFeed).Methods("PUT")
|
||||
sr.HandleFunc("/feeds/{feedID}", handler.removeFeed).Methods("DELETE")
|
||||
sr.HandleFunc("/feeds/{feedID}/icon", handler.feedIcon).Methods("GET")
|
||||
sr.HandleFunc("/export", handler.exportFeeds).Methods("GET")
|
||||
sr.HandleFunc("/import", handler.importFeeds).Methods("POST")
|
||||
sr.HandleFunc("/feeds/{feedID}/entries", handler.getFeedEntries).Methods("GET")
|
||||
sr.HandleFunc("/feeds/{feedID}/entries/{entryID}", handler.getFeedEntry).Methods("GET")
|
||||
sr.HandleFunc("/entries", handler.getEntries).Methods("GET")
|
||||
sr.HandleFunc("/entries", handler.setEntryStatus).Methods("PUT")
|
||||
sr.HandleFunc("/entries/{entryID}", handler.getEntry).Methods("GET")
|
||||
sr.HandleFunc("/entries/{entryID}/bookmark", handler.toggleBookmark).Methods("PUT")
|
||||
sr.Methods(http.MethodOptions)
|
||||
sr.HandleFunc("/users", handler.createUser).Methods(http.MethodPost)
|
||||
sr.HandleFunc("/users", handler.users).Methods(http.MethodGet)
|
||||
sr.HandleFunc("/users/{userID:[0-9]+}", handler.userByID).Methods(http.MethodGet)
|
||||
sr.HandleFunc("/users/{userID:[0-9]+}", handler.updateUser).Methods(http.MethodPut)
|
||||
sr.HandleFunc("/users/{userID:[0-9]+}", handler.removeUser).Methods(http.MethodDelete)
|
||||
sr.HandleFunc("/users/{username}", handler.userByUsername).Methods(http.MethodGet)
|
||||
sr.HandleFunc("/me", handler.currentUser).Methods(http.MethodGet)
|
||||
sr.HandleFunc("/categories", handler.createCategory).Methods(http.MethodPost)
|
||||
sr.HandleFunc("/categories", handler.getCategories).Methods(http.MethodGet)
|
||||
sr.HandleFunc("/categories/{categoryID}", handler.updateCategory).Methods(http.MethodPut)
|
||||
sr.HandleFunc("/categories/{categoryID}", handler.removeCategory).Methods(http.MethodDelete)
|
||||
sr.HandleFunc("/discover", handler.getSubscriptions).Methods(http.MethodPost)
|
||||
sr.HandleFunc("/feeds", handler.createFeed).Methods(http.MethodPost)
|
||||
sr.HandleFunc("/feeds", handler.getFeeds).Methods(http.MethodGet)
|
||||
sr.HandleFunc("/feeds/refresh", handler.refreshAllFeeds).Methods(http.MethodPut)
|
||||
sr.HandleFunc("/feeds/{feedID}/refresh", handler.refreshFeed).Methods(http.MethodPut)
|
||||
sr.HandleFunc("/feeds/{feedID}", handler.getFeed).Methods(http.MethodGet)
|
||||
sr.HandleFunc("/feeds/{feedID}", handler.updateFeed).Methods(http.MethodPut)
|
||||
sr.HandleFunc("/feeds/{feedID}", handler.removeFeed).Methods(http.MethodDelete)
|
||||
sr.HandleFunc("/feeds/{feedID}/icon", handler.feedIcon).Methods(http.MethodGet)
|
||||
sr.HandleFunc("/export", handler.exportFeeds).Methods(http.MethodGet)
|
||||
sr.HandleFunc("/import", handler.importFeeds).Methods(http.MethodPost)
|
||||
sr.HandleFunc("/feeds/{feedID}/entries", handler.getFeedEntries).Methods(http.MethodGet)
|
||||
sr.HandleFunc("/feeds/{feedID}/entries/{entryID}", handler.getFeedEntry).Methods(http.MethodGet)
|
||||
sr.HandleFunc("/entries", handler.getEntries).Methods(http.MethodGet)
|
||||
sr.HandleFunc("/entries", handler.setEntryStatus).Methods(http.MethodPut)
|
||||
sr.HandleFunc("/entries/{entryID}", handler.getEntry).Methods(http.MethodGet)
|
||||
sr.HandleFunc("/entries/{entryID}/bookmark", handler.toggleBookmark).Methods(http.MethodPut)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue