func TestMarshalling(t *testing.T) {
	SetConfigType("yaml")
	r := bytes.NewReader(yamlExample)

	marshalReader(r, v.config)
	assert.True(t, InConfig("name"))
	assert.False(t, InConfig("state"))
	assert.Equal(t, "steve", Get("name"))
	assert.Equal(t, []interface{}{"skateboarding", "snowboarding", "go"}, Get("hobbies"))
	assert.Equal(t, map[interface{}]interface{}{"jacket": "leather", "trousers": "denim"}, Get("clothing"))
	assert.Equal(t, 35, Get("age"))
}
func TestReadBufConfig(t *testing.T) {
	v := New()
	v.SetConfigType("yaml")
	v.ReadConfig(bytes.NewBuffer(yamlExample))
	t.Log(v.AllKeys())

	assert.True(t, v.InConfig("name"))
	assert.False(t, v.InConfig("state"))
	assert.Equal(t, "steve", v.Get("name"))
	assert.Equal(t, []interface{}{"skateboarding", "snowboarding", "go"}, v.Get("hobbies"))
	assert.Equal(t, map[interface{}]interface{}{"jacket": "leather", "trousers": "denim"}, v.Get("clothing"))
	assert.Equal(t, 35, v.Get("age"))
}
func TestCORS(t *testing.T) {
	mw := cors()
	req := testRequest(nil, "GET", "/", nil)
	res := httptest.NewRecorder()
	c := echo.NewContext(req.Request, echo.NewResponse(res), echo.New())
	called := false

	next := func(c *echo.Context) error {
		called = true
		return nil
	}

	// It calls the next middleware when no origin is set
	h := mw(next)
	h(c)
	assert.True(t, called)
	assert.Empty(t, res.Header().Get("Access-Control-Allow-Origin"))

	// It sets CORS headers and calls the next middleware when the origin is set
	req.Header.Set("Origin", "china")
	called = false
	h(c)
	assert.True(t, called)
	assert.NotEmpty(t, res.Header().Get("Access-Control-Allow-Origin"))

	// It sets CORS headers, ends the middleware chain and
	// returns 200 when receiving a preflight request
	req.Method = "OPTIONS"
	res = httptest.NewRecorder()
	c = echo.NewContext(req.Request, echo.NewResponse(res), echo.New())
	res.Code = 0
	called = false
	h(c)
	assert.False(t, called)
	assert.Equal(t, 200, res.Code)
	assert.NotEmpty(t, res.Header().Get("Access-Control-Allow-Origin"))
	assert.NotEmpty(t, res.Header().Get("Access-Control-Allow-Methods"))
	assert.NotEmpty(t, res.Header().Get("Access-Control-Allow-Headers"))
}