func (p *politeiawww) addRoute(method string, route string, handler http.HandlerFunc, perm permission, shouldLoadInventory bool) {
	fullRoute := v1.PoliteiaWWWAPIRoute + route

	if shouldLoadInventory {
		handler = p.loadInventory(handler)
	}
	switch perm {
	case permissionAdmin:
		handler = logging(p.isLoggedInAsAdmin(handler))
	case permissionLogin:
		handler = logging(p.isLoggedIn(handler))
	default:
		handler = logging(handler)
	}

	// All handlers need to close the body
	handler = closeBody(handler)

	p.router.StrictSlash(true).HandleFunc(fullRoute, handler).Methods(method)
}
// addRoute sets up a handler for a specific method+route.
addRoute sets up a handler for a specific method+route.
// addRoute sets up a handler for a specific method + route .
func (p *politeiawww) addRoute(method string, route string, handler http.HandlerFunc, perm permission, shouldLoadInventory bool) {
	fullRoute := v1.PoliteiaWWWAPIRoute + route
	if shouldLoadInventory {
		handler = p.loadInventory(handler)
	}
	switch perm {
	case permissionAdmin:
		handler = logging(p.isLoggedInAsAdmin(handler))
	case permissionLogin:
		handler = logging(p.isLoggedIn(handler))
	default:
		handler = logging(handler)
	}
	handler = closeBody(handler)
	p.router.StrictSlash(true).HandleFunc(fullRoute, handler).Methods(method)
}
func ( p * politeiawww ) addRoute ( method string , route string , handler http . HandlerFunc , perm permission , shouldLoadInventory bool ) { fullRoute := v1 . PoliteiaWWWAPIRoute + route if shouldLoadInventory { handler = p . loadInventory ( handler ) } switch perm { case permissionAdmin : handler = logging ( p . isLoggedInAsAdmin ( handler ) ) case permissionLogin : handler = logging ( p . isLoggedIn ( handler ) ) default : handler = logging ( handler ) } handler = closeBody ( handler ) p . router . StrictSlash ( true ) . HandleFunc ( fullRoute , handler ) . Methods ( method ) }
addRoute sets up a handler for a specific method+route.
addRoute sets up a handler for a specific method + route .
// All handlers need to close the body