MiddlewareUtil

MiddlewareUtil

Convenience functions for UI5 Server middleware. An instance of this class is passed to every standard UI5 Server middleware. Custom middleware that define a specification version >= 2.0 will also receive an instance of this class as part of the parameters of their create-middleware function. The set of functions that can be accessed by a custom middleware depends on the specification version defined for the extension.

Constructor

new MiddlewareUtil()

Source:

Methods

getMimeInfo(resourcePath) → {module:@ui5/server.middleware.MiddlewareUtil.MimeInfo}

Source:
Returns MIME information derived from a given resource path.

This method is only available to custom middleware extensions defining Specification Version 2.0 and above.
Parameters:
Name Type Description
resourcePath object
Returns:
Type
module:@ui5/server.middleware.MiddlewareUtil.MimeInfo

getPathname(req) → {string}

Source:
Returns the pathname of a given request. Any escape sequences will be decoded.

This method is only available to custom middleware extensions defining Specification Version 2.0 and above.
Parameters:
Name Type Description
req object Request object
Returns:
Pathname of the given request
Type
string

Type Definitions

MimeInfo

Source:
Properties:
Name Type Description
type string Detected content-type for the given resource path
charset string Default charset for the detected content-type
contentType string Calculated content-type header value
MIME Info
Type:
  • object
Example
const mimeInfo = {
	"type": "text/html",
	"charset": "utf-8",
	"contentType": "text/html; charset=utf-8"
};