internal static bool NotFound(this ResponseAdapter response) { response.SetHeader(HeaderConstants.TusResumable, HeaderConstants.TusResumableValue); response.SetHeader(HeaderConstants.CacheControl, HeaderConstants.NoStore); response.SetStatus((int)HttpStatusCode.NotFound); return(true); }
internal static async Task <bool> Error(this ResponseAdapter response, HttpStatusCode statusCode, string message) { response.SetHeader(HeaderConstants.ContentType, "text/plain"); response.SetHeader(HeaderConstants.TusResumable, HeaderConstants.TusResumableValue); response.SetStatus((int)statusCode); var buffer = new UTF8Encoding().GetBytes(message); await response.Body.WriteAsync(buffer, 0, buffer.Length); return(true); }
internal static async Task Error(this ResponseAdapter response, HttpStatusCode statusCode, string message, bool includeTusResumableHeader = true) { if (includeTusResumableHeader) { response.SetHeader(HeaderConstants.TusResumable, HeaderConstants.TusResumableValue); } response.SetStatus(statusCode); if (message != null) { response.SetHeader(HeaderConstants.ContentType, "text/plain"); var buffer = _utf8Encoding.GetBytes(message); await response.Body.WriteAsync(buffer, 0, buffer.Length); } }