new THTTPRequest()#

An THTTPRequest object is created by UB server and passed as the first argument to the endpoint's methods or as a second argument to the rest entity method's event.

It may be used to access HTTP request status, headers and data.


decodedParameters: stringinstance #

URLDecoded parameters


        // GET http://host:port/bla-bla?$filter=Name%20eq%20%27John%27
     req.parameters === '$filter=Name%20eq%20%27John%27'
     req.decodedParameters === "$filter=Name eq 'John'"
decodedUri: stringinstance #

The same as uri, but URLDecode'd


        //GET http://host:port/ub/rest/TripPinServiceRW/My%20People"
  req.decodedUri === 'TripPinServiceRW/My People'
headers: stringinstance #

HTTP request headers

method: stringinstance #

HTTP request method GET|POST|PUT......

parameters: stringinstance #

URL parameters. Can be transformed to object using queryString.parse


        // GET http://host:port/ub/rest/doc_document/report?id=1&param2=asdas
  req.parameters === 'id=1&param2=asdas'
uri: stringinstance #

URL WITHOUT appName and endpoint name


        // GET http://host:port/ub/rest/doc_document/report?id=1&param2=asdas
  req.uri === 'doc_document/report'
url: stringinstance #

Full URL


        // GET http://host:port/ub/rest/doc_document/report?id=1&param2=asdas
  req.url === 'ub/rest/doc_document/report?id=1&param2=asdas'


read(encodingopt: String)→ArrayBuffer | Stringinstance#

Read from source


Return String in case no encoding passed or ArrayBuffer

Arguments info:

  • encoding: String

    Optional encoding of source. Default to 'utf-8'. If 'bin' - return ArrayBuffer source representation without any conversion. If 'base64' - transform base64 encoded content of source to ArrayBuffer If 'bin2base64' - transform content to base64 encoded string

writeToFile(fullFilePath: string)→booleaninstance#

Write request body content (as binary) to a file. Return true on success