Move handler to established URI. Add CORS wildcard.
This commit is contained in:
@@ -93,6 +93,7 @@ func newMailCounter() *mailCounter {
|
||||
}
|
||||
|
||||
func (mc *mailCounter) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
c := map[string]int{}
|
||||
for k, v := range mc.counts {
|
||||
if v != 0 {
|
||||
@@ -269,7 +270,7 @@ func main() {
|
||||
|
||||
mc := newMailCounter()
|
||||
go func() {
|
||||
http.Handle("/", mc)
|
||||
http.Handle("/unread", mc)
|
||||
err := http.ListenAndServe(*addr, nil)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user