@@ -83,8 +83,7 @@ func TestContextPropagated(t *testing.T) {
83
83
}
84
84
}
85
85
86
- func TestHandler_BasicQuery (t * testing.T ) {
87
-
86
+ func TestHandler_BasicQuery_Pretty (t * testing.T ) {
88
87
expected := & graphql.Result {
89
88
Data : map [string ]interface {}{
90
89
"rebels" : map [string ]interface {}{
@@ -108,6 +107,32 @@ func TestHandler_BasicQuery(t *testing.T) {
108
107
t .Fatalf ("wrong result, graphql result diff: %v" , testutil .Diff (expected , result ))
109
108
}
110
109
}
110
+
111
+ func TestHandler_BasicQuery_Ugly (t * testing.T ) {
112
+ expected := & graphql.Result {
113
+ Data : map [string ]interface {}{
114
+ "rebels" : map [string ]interface {}{
115
+ "id" : "RmFjdGlvbjox" ,
116
+ "name" : "Alliance to Restore the Republic" ,
117
+ },
118
+ },
119
+ }
120
+ queryString := `query=query RebelsShipsQuery { rebels { id, name } }`
121
+ req , _ := http .NewRequest ("GET" , fmt .Sprintf ("/graphql?%v" , queryString ), nil )
122
+
123
+ h := handler .New (& handler.Config {
124
+ Schema : & starwars .Schema ,
125
+ Pretty : false ,
126
+ })
127
+ result , resp := executeTest (t , h , req )
128
+ if resp .Code != http .StatusOK {
129
+ t .Fatalf ("unexpected server response %v" , resp .Code )
130
+ }
131
+ if ! reflect .DeepEqual (result , expected ) {
132
+ t .Fatalf ("wrong result, graphql result diff: %v" , testutil .Diff (expected , result ))
133
+ }
134
+ }
135
+
111
136
func TestHandler_Params_NilParams (t * testing.T ) {
112
137
defer func () {
113
138
if r := recover (); r != nil {
0 commit comments