Skip to content

Commit

Permalink
Merge pull request #218 from DayS1eeper/master
Browse files Browse the repository at this point in the history
fix routes order
  • Loading branch information
p4tin authored Feb 27, 2020
2 parents 4d29b1e + 3ba1059 commit 8b6ddf5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func New() http.Handler {
r.HandleFunc("/health", health).Methods("GET")
r.HandleFunc("/{account}", actionHandler).Methods("GET", "POST")
r.HandleFunc("/queue/{queueName}", actionHandler).Methods("GET", "POST")
r.HandleFunc("/{account}/{queueName}", actionHandler).Methods("GET", "POST")
r.HandleFunc("/SimpleNotificationService/{id}.pem", pemHandler).Methods("GET")
r.HandleFunc("/{account}/{queueName}", actionHandler).Methods("GET", "POST")

return r
}
Expand Down
16 changes: 16 additions & 0 deletions app/router/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,19 @@ func TestIndexServerhandler_POST_GoodRequest_With_URL(t *testing.T) {
status, http.StatusOK)
}
}

func TestIndexServerhandler_GET_GoodRequest_Pem_cert(t *testing.T) {

req, err := http.NewRequest("GET", "/SimpleNotificationService/100010001000.pem", nil)
if err != nil {
t.Fatal(err)
}

rr := httptest.NewRecorder()
New().ServeHTTP(rr, req)

if status := rr.Code; status != http.StatusOK {
t.Errorf("handler returned wrong status code: got %v want %v",
status, http.StatusOK)
}
}

0 comments on commit 8b6ddf5

Please sign in to comment.