mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-12-27 07:59:47 +00:00
35 lines
610 B
Go
35 lines
610 B
Go
package conf_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/xtls/xray-core/common/serial"
|
|
. "github.com/xtls/xray-core/infra/conf"
|
|
"github.com/xtls/xray-core/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{},
|
|
},
|
|
})
|
|
}
|