ErrorResponse is the unhappy path response constructor for a mocked GraphQL request.\ Note that for the moment it is only possible to return a single error message.
(errorMsg string)
| 79 | // ErrorResponse is the unhappy path response constructor for a mocked GraphQL request.\ |
| 80 | // Note that for the moment it is only possible to return a single error message. |
| 81 | func ErrorResponse(errorMsg string) GQLResponse { |
| 82 | return GQLResponse{ |
| 83 | Errors: []struct { |
| 84 | Message string `json:"message"` |
| 85 | }{ |
| 86 | { |
| 87 | Message: errorMsg, |
| 88 | }, |
| 89 | }, |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | // githubv4InputStructToMap converts a struct to a map[string]any, it uses JSON marshalling rather than reflection |
| 94 | // to do so, because the json struct tags are used in the real implementation to produce the variable key names, |
no outgoing calls