new SGAppsServerRequest(request, server)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
request |
IncomingMessage | |
server |
SGAppsServer |
Members
_destroy :Array.<function()>
- Source:
Array of functions to be called on response end
Type:
- Array.<function()>
_flags :object
- Source:
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
complete |
boolean | The message.complete property will be true if a complete HTTP message has been received and successfully parsed. |
|
aborted |
boolean | The message.aborted property will be true if the request has been aborted. |
|
closed |
boolean | Indicates that the underlying connection was closed. |
|
_DEBUG_MAX_HANDLER_EXECUTION_TIME |
number |
<optional> |
define a bigger request timeout |
Array of functions to be called on response end
Type:
- object
_postDataBuffer :Buffer
post data buffer cache
Type:
- Buffer
AccessLoggerPaths :Object.<string, AccessLogger.AccessLoggerPath>
- Source:
Type:
- Object.<string, AccessLogger.AccessLoggerPath>
body :object
Type:
- object
bodyItems :Array.<SGAppsServerRequestPostDataItem>
Type:
- Array.<SGAppsServerRequestPostDataItem>
cookies :SGAppsServerRequestCookie
Type:
fileItems :Array.<SGAppsServerRequestFile>
Type:
- Array.<SGAppsServerRequestFile>
files :Object.<string, Array.<SGAppsServerRequestFile>>
Type:
- Object.<string, Array.<SGAppsServerRequestFile>>
MAX_POST_SIZE :number
- Source:
Type:
- number
Examples
// changing max post size to 4Mb
request.MAX_POST_SIZE = 4 * 1024 * 1024;
// reset max post size to global value
request.MAX_POST_SIZE = -1;
mountPath :string
- Source:
Type:
- string
params :SGAppsServerRequest.RequestParams
- Source:
Array of functions to be called on response end
Type:
postData :Promise.<Buffer>
request's post received data
Type:
- Promise.<Buffer>
query :object
- Source:
Type:
- object
request :IncomingMessage
- Source:
Type:
- IncomingMessage
session :SGAppsServerRequestSession
Type:
urlInfo :object
- Source:
Properties:
Name | Type | Description |
---|---|---|
original |
string | |
origin |
string | |
domain |
string | full domain of url |
domain_short |
string | domain without "www." |
pathname |
string | url's pathname |
reqQuery |
string | url's query from '?' |
protocol |
string | url.split('://')[0] |
url |
string | |
url_p |
string | |
isIp |
string | domain or Ip |
Type:
- object
Methods
_parseDeepFieldName(container, fieldName, fieldData, optionsopt)
Automatically used procedure for parsing formData field name if option server._options._REQUEST_FORM_PARAMS_DEEP_PARSE = true
. it's by default enabled but can be disabled when needed
Examples
paramsContainer = {};
request._parseDeepFieldName(paramsContainer, 'test[arr][data]', 2);
request._parseDeepFieldName(paramsContainer, 'test[arr][]', new Date());
request._parseDeepFieldName(paramsContainer, 'test[arr][]', 2);
request._parseDeepFieldName(paramsContainer, 'test[data]', 2);
// if _debug enabled warns will be emitted
// [Warn] [Request._parseDeepFieldName] Writing Array field "test[arr][]" into a object
// [Warn] [Request._parseDeepFieldName] Overwriting field "test[data]" value
console.log(paramsContainer)
{
"test": {
"arr": {
"1": "2021-02-12T21:23:01.913Z",
"2": 2,
"data": 2
},
"data": 2
}
}
paramsContainer = {};
request._parseDeepFieldName(paramsContainer, 'test[arr][]', new Date());
request._parseDeepFieldName(paramsContainer, 'test[arr][]', 2);
request._parseDeepFieldName(paramsContainer, 'test[arr][data]', 2);
request._parseDeepFieldName(paramsContainer, 'test[data]', 2);
// if _debug enabled warns will be emitted
// [Warn] [Request._parseDeepFieldName] Converting array to object due incorrect field "test[arr][data]" name
console.log(paramsContainer)
{
"test": {
"arr": {
"0": "2021-02-12T21:34:47.359Z",
"1": 2,
"data": 2
},
"data": 2
}
}
paramsContainer = {};
request._parseDeepFieldName(paramsContainer, 'test[arr][]', new Date());
request._parseDeepFieldName(paramsContainer, 'test[arr][]', 2);
request._parseDeepFieldName(paramsContainer, 'test[data]', 2);
console.log(paramsContainer)
{
"test": {
"arr": [
"2021-02-12T21:26:43.766Z",
2
],
"data": 2
}
}
Parameters:
Name | Type | Attributes | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
container |
object | ||||||||||||
fieldName |
string | ||||||||||||
fieldData |
any | ||||||||||||
options |
object |
<optional> |
Properties
|
getMountUpdatedUrl(url) → {MountUpdatedURL}
Parameters:
Name | Type | Description |
---|---|---|
url |
string |
Returns:
- Type
- MountUpdatedURL
Type Definitions
RequestParams
- Source:
Type:
- Object.<(string|number), string> | Array.<string>