DoxResponse class
Constructors
DoxResponse (dynamic _contentData )
content can be anything
String, int, Map, json serializable object, Stream<List<int>>, File
Properties
hashCode
→ int
The hash code for this object.
no setter inherited
The headers set with header , by name.
no setter
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
status
→ int ?
The status set with statusCode , or null (200).
no setter
Methods
cache (Duration duration )
→ DoxResponse
set cache
content (dynamic content )
→ DoxResponse
Set response status code default 200
contentBytes (Uint8List utf8Text )
→ DoxResponse
Set a text body that is already encoded as UTF-8. The bytes are
sent as they are, with no second encode. Like a String body, it
is sent as text/html with CoreFlags.htmlStrings when no content
type is set. getContent gives the text, so a middleware that
reads a String body works the same.
contentType (ContentType contentType )
→ DoxResponse
set content type such as json, text, html
cookie (DoxCookie cookie , {bool setExpire = false })
→ DoxResponse
Set cookie
getContent ()
→ dynamic
Get original content data. For a body set with contentBytes , the
text of the bytes.
getContentBytes ()
→ Uint8List ?
The body as UTF-8 bytes: the bytes of contentBytes , or a String
body encoded. Null when the body is not text, eg. JSON or a file.
set a header. It replaces the header with the same name, in any
case (cache-control and Cache-Control are one header).
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
process (HttpRequest request )
→ dynamic
This function is for internal use only
statusCode (int code )
→ DoxResponse
Set response status code default 200
stream (Stream <List <int > > stream )
→ DoxResponse
set stream data to response
toString ()
→ String
A string representation of this object.
inherited
Set list of headers by Map. A key in values replaces the header
with the same name, in any case (cache-control and
Cache-Control are one header). Other headers stay.