config_json_test.go 461 B

12345678910111213141516171819202122232425
  1. package blackhole_test
  2. import (
  3. "encoding/json"
  4. "testing"
  5. . "github.com/v2ray/v2ray-core/proxy/blackhole"
  6. "github.com/v2ray/v2ray-core/testing/assert"
  7. )
  8. func TestHTTPResponseJSON(t *testing.T) {
  9. assert := assert.On(t)
  10. rawJson := `{
  11. "response": {
  12. "type": "http"
  13. }
  14. }`
  15. config := new(Config)
  16. err := json.Unmarshal([]byte(rawJson), config)
  17. assert.Error(err).IsNil()
  18. _, ok := config.Response.(*HTTPResponse)
  19. assert.Bool(ok).IsTrue()
  20. }