Output returns json interface of the response
()
| 142 | |
| 143 | // Output returns json interface of the response |
| 144 | func (r *Response) Output() interface{} { |
| 145 | if r == nil { |
| 146 | return struct { |
| 147 | Errors json.RawMessage `json:"errors,omitempty"` |
| 148 | Data json.RawMessage `json:"data,omitempty"` |
| 149 | }{ |
| 150 | Errors: []byte(`[{"message": "Internal error - no response to write."}]`), |
| 151 | Data: JsonNull, |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | res := struct { |
| 156 | Errors []*x.GqlError `json:"errors,omitempty"` |
| 157 | Data json.RawMessage `json:"data,omitempty"` |
| 158 | Extensions *Extensions `json:"extensions,omitempty"` |
| 159 | }{ |
| 160 | Errors: r.Errors, |
| 161 | Data: r.Data.Bytes(), |
| 162 | } |
| 163 | |
| 164 | if x.Config.GraphQL.GetBool("extensions") { |
| 165 | res.Extensions = r.Extensions |
| 166 | } |
| 167 | return res |
| 168 | } |
| 169 | |
| 170 | // Extensions represents GraphQL extensions |
| 171 | type Extensions struct { |
no outgoing calls