githubv4InputStructToMap converts a struct to a map[string]any, it uses JSON marshalling rather than reflection to do so, because the json struct tags are used in the real implementation to produce the variable key names, and we need to ensure that when variable matching occurs in the http handler,
(s any)
| 94 | // to do so, because the json struct tags are used in the real implementation to produce the variable key names, |
| 95 | // and we need to ensure that when variable matching occurs in the http handler, the keys correctly match. |
| 96 | func githubv4InputStructToMap(s any) (map[string]any, error) { |
| 97 | jsonBytes, err := json.Marshal(s) |
| 98 | if err != nil { |
| 99 | return nil, err |
| 100 | } |
| 101 | |
| 102 | var result map[string]any |
| 103 | err = json.Unmarshal(jsonBytes, &result) |
| 104 | return result, err |
| 105 | } |
| 106 | |
| 107 | // NewMockedHTTPClient creates a new HTTP client that registers a handler for /graphql POST requests. |
| 108 | // For each request, an attempt will be be made to match the request body against the provided matchers. |
no outgoing calls
no test coverage detected