public static async Task <string> PostToJsonAsync(this GraphQlClient client, GraphQlMutation mutation, params KeyValuePair <string, string>[] headers) { var response = await client.PostMutationAsync(mutation, headers); await using var stream = response?.GetResponseStream(); using var reader = new StreamReader(stream ?? throw new InvalidOperationException(), Encoding.UTF8); return(reader.ReadToEnd()); }
public async Task Test1() { var client = new GraphQlClient("http://localhost:5000/graphql", new Serializer()); var response = await client.Query(new HeroQuery()); }
public static string PostToJson(this GraphQlClient client, GraphQlMutation mutation, params KeyValuePair <string, string>[] headers) => PostToJsonAsync(client, mutation, headers).Result;
public static string PostToJson(this GraphQlClient client, GraphQlQuery query, params KeyValuePair <string, string>[] headers) => PostToJsonAsync(client, query, headers).Result;