mirror of https://github.com/XTLS/Xray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
619 B
35 lines
619 B
4 years ago
|
package conf_test
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/xtls/xray-core/v1/common/serial"
|
||
|
. "github.com/xtls/xray-core/v1/infra/conf"
|
||
|
"github.com/xtls/xray-core/v1/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{},
|
||
|
},
|
||
|
})
|
||
|
}
|