MCPcopy
hub / github.com/MetaCubeX/mihomo / TestServerHandlerModeRestrictions

Function TestServerHandlerModeRestrictions

transport/xhttp/server_test.go:13–104  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestServerHandlerModeRestrictions(t *testing.T) {
14 testCases := []struct {
15 name string
16 mode string
17 method string
18 target string
19 wantStatus int
20 }{
21 {
22 name: "StreamOneAcceptsStreamOne",
23 mode: "stream-one",
24 method: http.MethodPost,
25 target: "https://example.com/xhttp/",
26 wantStatus: http.StatusOK,
27 },
28 {
29 name: "StreamOneRejectsSessionDownload",
30 mode: "stream-one",
31 method: http.MethodGet,
32 target: "https://example.com/xhttp/session",
33 wantStatus: http.StatusNotFound,
34 },
35 {
36 name: "StreamUpAcceptsStreamOne",
37 mode: "stream-up",
38 method: http.MethodPost,
39 target: "https://example.com/xhttp/",
40 wantStatus: http.StatusOK,
41 },
42 {
43 name: "StreamUpAllowsDownloadEndpoint",
44 mode: "stream-up",
45 method: http.MethodGet,
46 target: "https://example.com/xhttp/session",
47 wantStatus: http.StatusOK,
48 },
49 {
50 name: "StreamUpRejectsPacketUpload",
51 mode: "stream-up",
52 method: http.MethodPost,
53 target: "https://example.com/xhttp/session/0",
54 wantStatus: http.StatusNotFound,
55 },
56 {
57 name: "PacketUpAllowsDownloadEndpoint",
58 mode: "packet-up",
59 method: http.MethodGet,
60 target: "https://example.com/xhttp/session",
61 wantStatus: http.StatusOK,
62 },
63 {
64 name: "PacketUpRejectsStreamOne",
65 mode: "packet-up",
66 method: http.MethodPost,
67 target: "https://example.com/xhttp/",
68 wantStatus: http.StatusNotFound,
69 },
70 {

Callers

nothing calls this directly

Calls 7

FillStreamRequestMethod · 0.95
ResultMethod · 0.80
NewServerHandlerFunction · 0.70
CloseMethod · 0.65
EqualMethod · 0.65
RunMethod · 0.45
ServeHTTPMethod · 0.45

Tested by

no test coverage detected