Object built-in object

ObjectHttpHandler

httpprotocol conversion processor

to transform the data stream intohttpProtocol message, created by:

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

or:

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

inheritance relationship

Constructor

HttpHandler

CreatehttpA protocol handler object that transforms the data of a stream object intohttpmessage object

1
new HttpHandler(Handler hdlr);

Call parameters:

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

member attribute

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;

enableEncoding

Boolean, automatic decompression function switch, the default is off

1
Boolean HttpHandler.enableEncoding;

serverName

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

1
String HttpHandler.serverName;

handler

Handler,httpProtocol 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, specifies the acceptedhttpheader field

invoke

process a message or object

1
Handler HttpHandler.invoke(object v) async;

Call parameters:

  • v:object, specifies the message or object to process

return result:

  • Handler, returns the handler for the next step

toString

Return the string representation of the object, generally return "[Native Object]", the object can be reimplemented according to its own characteristics

1
String HttpHandler.toString();

return result:

  • String, returns a string representation of the object

toJSON

Returns the JSON format representation of the object, generally returns a collection of readable properties defined by the object

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

Call parameters:

  • key: String, not used

return result:

  • Value, which returns a JSON-serializable value