mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-09-01 09:14:15 -04:00
35 lines
625 B
Go
35 lines
625 B
Go
package conf_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/v2fly/v2ray-core/v4/common/serial"
|
|
. "github.com/v2fly/v2ray-core/v4/infra/conf"
|
|
"github.com/v2fly/v2ray-core/v4/proxy/blackhole"
|
|
)
|
|
|
|
func TestHTTPResponseJSON(t *testing.T) {
|
|
creator := func() Buildable {
|
|
return new(BlackholeConfig)
|
|
}
|
|
|
|
runMultiTestCase(t, []TestCase{
|
|
{
|
|
Input: `{
|
|
"response": {
|
|
"type": "http"
|
|
}
|
|
}`,
|
|
Parser: loadJSON(creator),
|
|
Output: &blackhole.Config{
|
|
Response: serial.ToTypedMessage(&blackhole.HTTPResponse{}),
|
|
},
|
|
},
|
|
{
|
|
Input: `{}`,
|
|
Parser: loadJSON(creator),
|
|
Output: &blackhole.Config{},
|
|
},
|
|
})
|
|
}
|