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.

Members

decodedParameters: stringinstance #

URLDecoded parameters

Examples:

    
        // 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

Examples:

    
        //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

Examples:

    
        // 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

Examples:

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

Full URL

Examples:

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

Methods

read(encodingopt: String)→ArrayBuffer | Stringinstance#

Read from source

Return:

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