Object HttpHandler
http Protocol conversion processor
Used to convert the data stream into http Protocol message, creation method:
1var hdlr = new mq.HttpHandler(...);
or:
1var hdlr = new http.Handler(...);
Inheritance
Constructor
HttpHandler
Create http The protocol handler object converts the data of the stream object into http Message object
1new HttpHandler(Handler hdlr);
Call parameters:
- hdlr: Handler, Built-in message processor, processing function, chain processing array, routing object, see details mq.Handler
Member attributes
maxHeadersCount
Integer, query and set the maximum number of request headers, the default is 128
1Integer HttpHandler.maxHeadersCount;
maxBodySize
Integer, query and set the maximum size of the body, in MB, the default is 64
1Integer HttpHandler.maxBodySize;
enableEncoding
Boolean, automatic decompression function switch, closed by default
1Boolean HttpHandler.enableEncoding;
serverName
String, query and set the server name, the default is: fibjs/0.x.0
1String HttpHandler.serverName;
handler
Handler, http Protocol conversion processor current event processing interface object
1Handler HttpHandler.handler;
Member function
enableCrossOrigin
Allow cross-domain requests
1HttpHandler.enableCrossOrigin(String allowHeaders = "Content-Type");
Call parameters:
- allowHeaders: String, specified to accept http Header field
invoke
Process a message or object
1Handler HttpHandler.invoke(object v) async;
Call parameters:
- v: object, Specify the message or object to be processed
Return result:
- Handler, Return to the next processor
toString
Returns the string representation of the object, generally returns "[Native Object]", the object can be re-implemented according to its own characteristics
1String HttpHandler.toString();
Return result:
- String, Returns the string representation of the object
toJSON
Returns the JSON format representation of the object, generally returns a collection of readable attributes defined by the object
1Value HttpHandler.toJSON(String key = "");
Call parameters:
- key: String, unused
Return result:
- Value, Returns a value containing JSON serializable