Dry the tests and produced json.

This commit is contained in:
2021-03-27 09:11:37 +00:00
parent 6b59e24be5
commit cbd102baef
3 changed files with 47 additions and 28 deletions
+8 -1
View File
@@ -26,7 +26,14 @@ func queryBuilder(data string, variables interface{}) []byte {
fmt.Println(err)
panic("Unable to process the query")
}
return j.Bytes()
// Attemt to decrease size of the generated JSON
compactedBuffer := new(bytes.Buffer)
err := json.Compact(compactedBuffer, j.Bytes())
if err != nil {
fmt.Println(err)
panic("Unable to compress json")
}
return []byte(compactedBuffer.String())
}
func Query(query string, variables interface{}, headers map[string]interface{}) string {