Class: ApiResponse<Request>
@sapphire/plugin-api.ApiResponse
Since
1.0.0
Type parameters
Name | Type |
---|---|
Request | extends IncomingMessage = IncomingMessage |
Hierarchy
-
ServerResponse
<Request
>↳
ApiResponse
Constructors
constructor
• new ApiResponse<Request
>(req
): ApiResponse
<Request
>
Type parameters
Name | Type |
---|---|
Request | extends IncomingMessage = IncomingMessage |
Parameters
Name | Type |
---|---|
req | Request |
Returns
Inherited from
ServerResponse<Request>.constructor
Defined in
node_modules/@types/node/http.d.ts:739
Properties
chunkedEncoding
• chunkedEncoding: boolean
Inherited from
ServerResponse.chunkedEncoding
Defined in
node_modules/@types/node/http.d.ts:547
closed
• Readonly
closed: boolean
Is true
after 'close'
has been emitted.
Since
v18.0.0
Inherited from
ServerResponse.closed
Defined in
node_modules/@types/node/stream.d.ts:704
connection
• Readonly
connection: null
| Socket
Alias of outgoingMessage.socket
.
Since
v0.3.0
Deprecated
Since v15.12.0,v14.17.1 - Use socket
instead.
Inherited from
ServerResponse.connection
Defined in
node_modules/@types/node/http.d.ts:565
cookies
• cookies: CookieStore
Since
1.0.0
Defined in
projects/plugins/packages/api/src/lib/structures/api/ApiResponse.ts:13
destroyed
• destroyed: boolean
Is true
after writable.destroy()
has been called.
Since
v8.0.0
Inherited from
ServerResponse.destroyed
Defined in
node_modules/@types/node/stream.d.ts:699
errored
• Readonly
errored: null
| Error
Returns error if the stream has been destroyed with an error.
Since
v18.0.0
Inherited from
ServerResponse.errored
Defined in
node_modules/@types/node/stream.d.ts:709
finished
• finished: boolean
Deprecated
Use writableEnded
instead.
Inherited from
ServerResponse.finished
Defined in
node_modules/@types/node/http.d.ts:554
headersSent
• Readonly
headersSent: boolean
Read-only. true
if the headers were sent, otherwise false
.
Since
v0.9.3
Inherited from
ServerResponse.headersSent
Defined in
node_modules/@types/node/http.d.ts:559
req
• Readonly
req: Request
Inherited from
ServerResponse.req
Defined in
node_modules/@types/node/http.d.ts:546
sendDate
• sendDate: boolean
Inherited from
ServerResponse.sendDate
Defined in
node_modules/@types/node/http.d.ts:550
shouldKeepAlive
• shouldKeepAlive: boolean
Inherited from
ServerResponse.shouldKeepAlive
Defined in
node_modules/@types/node/http.d.ts:548
socket
• Readonly
socket: null
| Socket
Reference to the underlying socket. Usually, users will not want to access this property.
After calling outgoingMessage.end()
, this property will be nulled.
Since
v0.3.0
Inherited from
ServerResponse.socket
Defined in
node_modules/@types/node/http.d.ts:573
statusCode
• statusCode: number
When using implicit headers (not calling response.writeHead()
explicitly),
this property controls the status code that will be sent to the client when
the headers get flushed.
response.statusCode = 404;
After response header was sent to the client, this property indicates the status code which was sent out.
Since
v0.4.0
Inherited from
ServerResponse.statusCode
Defined in
node_modules/@types/node/http.d.ts:716
statusMessage
• statusMessage: string
When using implicit headers (not calling response.writeHead()
explicitly),
this property controls the status message that will be sent to the client when
the headers get flushed. If this is left as undefined
then the standard
message for the status code will be used.
response.statusMessage = 'Not found';
After response header was sent to the client, this property indicates the status message which was sent out.
Since
v0.11.8
Inherited from
ServerResponse.statusMessage
Defined in
node_modules/@types/node/http.d.ts:731
strictContentLength
• strictContentLength: boolean
If set to true
, Node.js will check whether the Content-Length
header value and the size of the body, in bytes, are equal.
Mismatching the Content-Length
header value will result
in an Error
being thrown, identified by code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'
.
Since
v18.10.0, v16.18.0
Inherited from
ServerResponse.strictContentLength
Defined in
node_modules/@types/node/http.d.ts:738
useChunkedEncodingByDefault
• useChunkedEncodingByDefault: boolean
Inherited from
ServerResponse.useChunkedEncodingByDefault
Defined in
node_modules/@types/node/http.d.ts:549
writable
• Readonly
writable: boolean
Is true
if it is safe to call writable.write()
, which means
the stream has not been destroyed, errored, or ended.
Since
v11.4.0
Inherited from
ServerResponse.writable
Defined in
node_modules/@types/node/stream.d.ts:660
writableCorked
• Readonly
writableCorked: number
Number of times writable.uncork()
needs to be
called in order to fully uncork the stream.
Since
v13.2.0, v12.16.0
Inherited from
ServerResponse.writableCorked
Defined in
node_modules/@types/node/stream.d.ts:694
writableEnded
• Readonly
writableEnded: boolean
Is true
after writable.end()
has been called. This property
does not indicate whether the data has been flushed, for this use writable.writableFinished
instead.
Since
v12.9.0
Inherited from
ServerResponse.writableEnded
Defined in
node_modules/@types/node/stream.d.ts:666
writableFinished
• Readonly
writableFinished: boolean
Is set to true
immediately before the 'finish'
event is emitted.
Since
v12.6.0
Inherited from
ServerResponse.writableFinished
Defined in
node_modules/@types/node/stream.d.ts:671
writableHighWaterMark
• Readonly
writableHighWaterMark: number
Return the value of highWaterMark
passed when creating this Writable
.
Since
v9.3.0
Inherited from
ServerResponse.writableHighWaterMark
Defined in
node_modules/@types/node/stream.d.ts:676
writableLength
• Readonly
writableLength: number
This property contains the number of bytes (or objects) in the queue
ready to be written. The value provides introspection data regarding
the status of the highWaterMark
.
Since
v9.4.0
Inherited from
ServerResponse.writableLength
Defined in
node_modules/@types/node/stream.d.ts:683
writableNeedDrain
• Readonly
writableNeedDrain: boolean
Is true
if the stream's buffer has been full and stream will emit 'drain'
.
Since
v15.2.0, v14.17.0
Inherited from
ServerResponse.writableNeedDrain
Defined in
node_modules/@types/node/stream.d.ts:714
writableObjectMode
• Readonly
writableObjectMode: boolean
Getter for the property objectMode
of a given Writable
stream.
Since
v12.3.0
Inherited from
ServerResponse.writableObjectMode
Defined in
node_modules/@types/node/stream.d.ts:688
captureRejectionSymbol
▪ Static
Readonly
captureRejectionSymbol: typeof captureRejectionSymbol
Value: Symbol.for('nodejs.rejection')
See how to write a custom rejection handler
.
Since
v13.4.0, v12.16.0
Inherited from
ServerResponse.captureRejectionSymbol
Defined in
node_modules/@types/node/events.d.ts:402
captureRejections
▪ Static
captureRejections: boolean
Value: boolean
Change the default captureRejections
option on all new EventEmitter
objects.
Since
v13.4.0, v12.16.0
Inherited from
ServerResponse.captureRejections
Defined in
node_modules/@types/node/events.d.ts:409
defaultMaxListeners
▪ Static
defaultMaxListeners: number
By default, a maximum of 10
listeners can be registered for any single
event. This limit can be changed for individual EventEmitter
instances
using the emitter.setMaxListeners(n)
method. To change the default
for allEventEmitter
instances, the events.defaultMaxListeners
property can be used. If this value is not a positive number, a RangeError
is thrown.
Take caution when setting the events.defaultMaxListeners
because the
change affects allEventEmitter
instances, including those created before
the change is made. However, calling emitter.setMaxListeners(n)
still has
precedence over events.defaultMaxListeners
.
This is not a hard limit. The EventEmitter
instance will allow
more listeners to be added but will output a trace warning to stderr indicating
that a "possible EventEmitter memory leak" has been detected. For any singleEventEmitter
, the emitter.getMaxListeners()
and emitter.setMaxListeners()
methods can be used to
temporarily avoid this warning:
import { EventEmitter } from 'node:events';
const emitter = new EventEmitter();
emitter.setMaxListeners(emitter.getMaxListeners() + 1);
emitter.once('event', () => {
// do stuff
emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0));
});
The --trace-warnings
command-line flag can be used to display the
stack trace for such warnings.
The emitted warning can be inspected with process.on('warning')
and will
have the additional emitter
, type
, and count
properties, referring to
the event emitter instance, the event's name and the number of attached
listeners, respectively.
Its name
property is set to 'MaxListenersExceededWarning'
.
Since
v0.11.2
Inherited from
ServerResponse.defaultMaxListeners
Defined in
node_modules/@types/node/events.d.ts:446
errorMonitor
▪ Static
Readonly
errorMonitor: typeof errorMonitor
This symbol shall be used to install a listener for only monitoring 'error'
events. Listeners installed using this symbol are called before the regular'error'
listeners are called.
Installing a listener using this symbol does not change the behavior once an'error'
event is emitted. Therefore, the process will still crash if no
regular 'error'
listener is installed.
Since
v13.6.0, v12.17.0
Inherited from
ServerResponse.errorMonitor
Defined in
node_modules/@types/node/events.d.ts:395
Methods
[captureRejectionSymbol]
▸ [captureRejectionSymbol](error
, event
, ...args
): void
Parameters
Name | Type |
---|---|
error | Error |
event | string |
...args | any [] |
Returns
void
Inherited from
ServerResponse.[captureRejectionSymbol]
Defined in
node_modules/@types/node/events.d.ts:112
_construct
▸ _construct(callback
): void
Parameters
Name | Type |
---|---|
callback | (error? : null | Error ) => void |
Returns
void
Inherited from
ServerResponse._construct
Defined in
node_modules/@types/node/stream.d.ts:724
_destroy
▸ _destroy(error
, callback
): void
Parameters
Name | Type |
---|---|
error | null | Error |
callback | (error? : null | Error ) => void |
Returns
void
Inherited from
ServerResponse._destroy
Defined in
node_modules/@types/node/stream.d.ts:725
_final
▸ _final(callback
): void
Parameters
Name | Type |
---|---|
callback | (error? : null | Error ) => void |
Returns
void
Inherited from
ServerResponse._final
Defined in
node_modules/@types/node/stream.d.ts:726
_write
▸ _write(chunk
, encoding
, callback
): void
Parameters
Name | Type |
---|---|
chunk | any |
encoding | BufferEncoding |
callback | (error? : null | Error ) => void |
Returns
void
Inherited from
ServerResponse._write
Defined in
node_modules/@types/node/stream.d.ts:716
_writev
▸ _writev(chunks
, callback
): void
Parameters
Name | Type |
---|---|
chunks | { chunk : any ; encoding : BufferEncoding }[] |
callback | (error? : null | Error ) => void |
Returns
void
Inherited from
ServerResponse._writev