public HttpRequestMessage GetGraphQLHttpRequest(string definition, Dictionary <string, object> variables) { var request = GetHttpRequest(Configuration.GetGraphQLUrl(), "post"); var body = FormatGraphQLRequest(definition, variables); var body_bytes = encoding.GetBytes(body); var utf8_string = encoding.GetString(body_bytes); request.Content = new StringContent(utf8_string, encoding, "application/json"); request.Content.Headers.ContentLength = System.Text.UTF8Encoding.UTF8.GetByteCount(utf8_string); return(request); }
public HttpWebRequest GetGraphQLHttpRequest(string definition, Dictionary <string, object> variables) { var request = GetHttpRequest(Configuration.GetGraphQLUrl(), "post"); var body = FormatGraphQLRequest(definition, variables); var body_bytes = encoding.GetBytes(body); request.ContentLength = body_bytes.Length; using (Stream requestStream = request.GetRequestStream()) { requestStream.Write(body_bytes, 0, body_bytes.Length); } return(request); }