public ResponseEntity() { if (this.Headers == null) { Headers = new ServerResponseHeaders(); } if (ResponseEntitySettings == null) { ResponseEntitySettings = new ResponseEntitySettings(); } }
public void CheckHeaderRangePopulatedCorrectly() { var headers = new ServerResponseHeaders(); headers.SetRange(RangeHeader.Create(new RangeHeaderValue(0, 50))); Assert.AreEqual("bytes 0-50/50", headers.Range); headers.SetRange(RangeHeader.Create(new RangeHeaderValue())); Assert.AreEqual("bytes 0-0/0", headers.Range); headers = new ServerResponseHeaders(); Assert.AreEqual(null, headers.Range); }
public void CheckCorsPopulatedCorrectly() { var headers = new ServerResponseHeaders(); headers.SetCors(CorsHeader.BuildHeader("*")); Assert.AreEqual("*", headers.Cors); headers.SetCors(CorsHeader.BuildHeader("http://localhost:2019/test")); Assert.AreEqual("localhost:2019", headers.Cors); headers.SetCors(CorsHeader.BuildHeader("http://www.google.com")); Assert.AreEqual("www.google.com", headers.Cors); }
static ExceptionHandler() { Headers = new ServerResponseHeaders(); Headers.SetCors(CorsHeader.BuildHeader("*")); }
public ResponseEntity(object data, ServerResponseHeaders headers, ResponseEntitySettings settings) : this(data, headers) { ResponseEntitySettings = settings; }
public ResponseEntity(object data, ServerResponseHeaders headers) : this(data) { Headers = headers; }