public Format ( |
||
textWriter | ||
Résultat | void |
public async Task<LineProtocolWriteResult> WriteAsync(LineProtocolPayload payload, CancellationToken cancellationToken = default(CancellationToken)) { var endpoint = $"write?db={Uri.EscapeDataString(_database)}"; if (!string.IsNullOrEmpty(_username)) endpoint += $"&u={Uri.EscapeDataString(_username)}&p={Uri.EscapeDataString(_password)}"; var payloadText = new StringWriter(); payload.Format(payloadText); var content = new StringContent(payloadText.ToString(), Encoding.UTF8); var response = await _httpClient.PostAsync(endpoint, content, cancellationToken); if (response.IsSuccessStatusCode) return new LineProtocolWriteResult(true, null); return new LineProtocolWriteResult(false, $"{response.StatusCode} {response.ReasonPhrase}"); }