Skip to content

Commit

Permalink
modified: violetear.go
Browse files Browse the repository at this point in the history
	modified:   violetear_test.go
  • Loading branch information
nbari committed Oct 3, 2015
1 parent 99b97d3 commit 4c98d54
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
15 changes: 4 additions & 11 deletions violetear.go
Expand Up @@ -79,21 +79,17 @@ type Router struct {

// Verbose
Verbose bool

// DefaultContentType
DefaultContentType string
}

var split_path_rx = regexp.MustCompile(`[^/ ]+`)

// New returns a new initialized router.
func New() *Router {
return &Router{
routes: NewTrie(),
dynamicRoutes: make(dynamicSet),
extraHeaders: make(map[string]string),
Verbose: true,
DefaultContentType: "application/json; charset=UTF-8",
routes: NewTrie(),
dynamicRoutes: make(dynamicSet),
extraHeaders: make(map[string]string),
Verbose: true,
}
}

Expand Down Expand Up @@ -211,9 +207,6 @@ func (v *Router) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set(k, v)
}

// set Content-type
w.Header().Set("Content-Type", v.DefaultContentType)

//h http.Handler
h := match(node, path, leaf)

Expand Down
3 changes: 1 addition & 2 deletions violetear_test.go
Expand Up @@ -176,9 +176,8 @@ func TestRouter(t *testing.T) {

router.ServeHTTP(w, req)
expect(t, w.Code, http.StatusOK)
expect(t, len(w.HeaderMap), 3)
expect(t, len(w.HeaderMap), 2)
expectDeepEqual(t, w.HeaderMap["X-App-Epazote"], []string{"1.1"})
expectDeepEqual(t, w.HeaderMap["Content-Type"], []string{"application/json; charset=UTF-8"})
}

func TestRoutes(t *testing.T) {
Expand Down

0 comments on commit 4c98d54

Please sign in to comment.