QResponse
@quik/http / QResponse
Class: QResponse<TResponse>
Defined in: http/src/router/endpoint/QResponse.ts:10
The response object returned by the function when it finished the execution.
Extends
QObject
Type Parameters
TResponse
TResponse = any
Implements
IQResponse<TResponse>
Constructors
Constructor
new QResponse<
TResponse>(data?):QResponse<TResponse>
Defined in: http/src/router/endpoint/QResponse.ts:16
The response object constructor.
Parameters
data?
Partial<IQResponse> = {}
The properties to be set to the response.
Returns
QResponse<TResponse>
Overrides
QObject.constructor
Accessors
body
Get Signature
get body():
TResponse
Defined in: http/src/router/endpoint/QResponse.ts:156
Getter of the response content property.
Returns
TResponse
Set Signature
set body(
body):void
Defined in: http/src/router/endpoint/QResponse.ts:165
Setter of the response content property.
Parameters
body
TResponse
The value to be set.
Returns
void
Implementation of
contentType
Get Signature
get contentType():
string
Defined in: http/src/router/endpoint/QResponse.ts:93
Getter of the contentType response property.
Returns
string
Set Signature
set contentType(
contentType):void
Defined in: http/src/router/endpoint/QResponse.ts:102
Setter of the contentType response property.
Parameters
contentType
string
The value to be set.
Returns
void
Implementation of
fileName
Get Signature
get fileName():
string
Defined in: http/src/router/endpoint/QResponse.ts:114
Getter of the fileName response property.
Returns
string
Set Signature
set fileName(
fileName):void
Defined in: http/src/router/endpoint/QResponse.ts:123
Setter of the fileName response property.
Parameters
fileName
string
The value to be set.
Returns
void
Implementation of
headers
Get Signature
get headers():
Record<string,string>
Defined in: http/src/router/endpoint/QResponse.ts:74
Getter for the headers.
Returns
Record<string, string>
Set Signature
set headers(
headers):void
Defined in: http/src/router/endpoint/QResponse.ts:81
Setter for the headers.
Parameters
headers
Record<string, string>
Returns
void
Implementation of
isFile
Get Signature
get isFile():
boolean
Defined in: http/src/router/endpoint/QResponse.ts:35
Getter for the file download flag.
Returns
boolean
Set Signature
set isFile(
isFile):void
Defined in: http/src/router/endpoint/QResponse.ts:44
Setter for the file download flag.
Parameters
isFile
boolean
The flag value.
Returns
void
Implementation of
logger
Get Signature
get
protectedlogger():IQLogger
Defined in: core/src/QObject.ts:15
The logger getter for the object.
Returns
IQLogger
Inherited from
QObject.logger
name
Get Signature
get name():
string
Defined in: core/src/QObject.ts:8
Returns
string
Inherited from
QObject.name
redirect
Get Signature
get redirect():
string
Defined in: http/src/router/endpoint/QResponse.ts:56
Getter for the redirect url.
Returns
string
Set Signature
set redirect(
redirect):void
Defined in: http/src/router/endpoint/QResponse.ts:65
Setter for the redirect url
Parameters
redirect
string
The url to which you want to redirect..
Returns
void
Implementation of
status
Get Signature
get status():
QHTTPStatus
Defined in: http/src/router/endpoint/QResponse.ts:135
Getter of the status response property.
Returns
QHTTPStatus
Set Signature
set status(
status):void
Defined in: http/src/router/endpoint/QResponse.ts:144
Setter of the status response property.
Parameters
status
QHTTPStatus
The value to be set.
Returns
void
Implementation of
Methods
endSpan()
protectedendSpan(span):void
Defined in: core/src/QObject.ts:35
End a span returned by startSpan.
Parameters
span
TelemetrySpan
The span to end.
Returns
void
Inherited from
QObject.endSpan
recordSpanError()
protectedrecordSpanError(span,err):void
Defined in: core/src/QObject.ts:45
Record an exception on an active span.
Parameters
span
TelemetrySpan
The span to record the error on.
err
unknown
The error to record.
Returns
void
Inherited from
QObject.recordSpanError
setHeader()
setHeader(
header,value):void
Defined in: http/src/router/endpoint/QResponse.ts:182
Set a header.
Parameters
header
string
The header to be set
value
string
The value of the header
Returns
void
setSpanAttribute()
protectedsetSpanAttribute(span,key,value):void
Defined in: core/src/QObject.ts:64
Set a single attribute on an active span.
Parameters
span
TelemetrySpan
The span to update.
key
string
Attribute key.
value
string | number | boolean
Attribute value.
Returns
void
Inherited from
QObject.setSpanAttribute
startSpan()
protectedstartSpan(spanName,options?):TelemetrySpan
Defined in: core/src/QObject.ts:26
Start a telemetry span for the given operation name. Returns undefined when no telemetry provider is active.
Parameters
spanName
string
Name of the span.
options?
TelemetrySpanOptions
Optional span attributes and kind.
Returns
TelemetrySpan
Inherited from
QObject.startSpan
toJSON()
toJSON():
IQResponse<TResponse>
Defined in: http/src/router/endpoint/QResponse.ts:189
Returns the JSON representation of the response object.
Returns
IQResponse<TResponse>
Implementation of
NewResponse()
staticNewResponse(contentType,body):QResponse
Defined in: http/src/router/endpoint/QResponse.ts:169
Parameters
contentType
string
body
any
Returns
QResponse