Object built-in object

Object HttpHandler

http protocol conversion processor

Used to convert data stream into http protocol message, creation method:

1
var hdlr = new mq.HttpHandler(...);

or:

1
var hdlr = new http.Handler(...);

Inheritance

Constructor

HttpHandler

Create an http protocol processor object, and convert the data of the stream object into an http message object

1
new HttpHandler(Handler hdlr);

Call parameters:

  • hdlr : Handler , built-in message processor, processing function, chain processing array, routing object, see mq.Handler details

Member attributes

maxHeadersCount

Integer, query and set the maximum number of request headers, the default is 128

1
Integer HttpHandler.maxHeadersCount;

maxBodySize

Integer, query and set the maximum size of the body, in MB, the default is 64

1
Integer HttpHandler.maxBodySize;

serverName

String, query and set the server name, the default is: fibjs/0.x.0

1
String HttpHandler.serverName;

handler

Handler , http protocol conversion processor current event processing interface object

1
Handler HttpHandler.handler;

Member function

enableCrossOrigin

Allow cross-domain requests

1
HttpHandler.enableCrossOrigin(String allowHeaders = "Content-Type");

Call parameters:

  • allowHeaders : String, specify the accepted http header fields

invoke

Process a message or object

1
Handler 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

1
String 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

1
Value HttpHandler.toJSON(String key = "");

Call parameters:

  • key : String, unused

Return result:

  • Value , returns a value containing JSON serializable