Skip to content

HttpResponseExtensions Class ​

Definition ​

Extensions for the HttpResponse class

  • Namespace: JASE.Extensions
  • Assembly: JASE.Web.dll

Methods ​

NameDescription
bool IsRedirect(HttpResponse response)Returns true is HttpResponse.StatusCode is 301 or 302
bool IsSuccess(HttpResponse response)Returns true is HttpResponse.StatusCode is between 200 and 299
void SetHeader(HttpResponse response, string header, string value)Sets the specified response header to the given value, replacing any existing value.
Task WriteCbor(HttpResponse response, object data)Serializes an object into CBOR format and writes it to the HttpResponse stream
Task WriteJson(HttpResponse response, object data, JsonSerializerOptions options = null, CancellationToken cancellationToken = null)Serilization of an object into an HttpResponse
Task<bool> WriteText(HttpResponse response, string text, int statusCode = null, string contentType = null, Encoding encoding = null, CancellationToken cancellationToken = null)Write text to the HttpResponse