Trait/Object

io.scalajs.npm.express

Response

Related Docs: object Response | package express

Permalink

trait Response extends Object with ServerResponse

The Response object represents the HTTP response that an Express app sends when it gets an HTTP request. In this documentation and by convention, the object is always referred to as res (and the HTTP request is req) but its actual name is determined by the parameters to the callback function in which you’re working.

Annotations
@RawJSType() @native()
Linear Supertypes
ServerResponse, IDuplex, Writable, Readable, IEventEmitter, Object, Any, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Response
  2. ServerResponse
  3. IDuplex
  4. Writable
  5. Readable
  6. IEventEmitter
  7. Object
  8. Any
  9. AnyRef
  10. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def _read(size: Int): Unit

    Permalink
    Definition Classes
    Readable
  5. def _readableState: ReadableState

    Permalink
    Definition Classes
    Readable
  6. def _write(chunk: Buffer, callback: Function1[Error, Any]): Unit

    Permalink
    Definition Classes
    Writable
  7. def _write(chunk: String, encoding: String, callback: Function1[Error, Any]): Unit

    Permalink
    Definition Classes
    Writable
  8. def _writev(chunks: Array[Chunk], callback: Function1[Error, Any]): Unit

    Permalink
    Definition Classes
    Writable
  9. def addListener(eventName: String, listener: Function): Response.this.type

    Permalink
    Definition Classes
    IEventEmitter
  10. def addTrailers(headers: Any): Unit

    Permalink
    Definition Classes
    ServerResponse
  11. def app: Application

    Permalink

    This property holds a reference to the instance of the Express application that is using the middleware.

    This property holds a reference to the instance of the Express application that is using the middleware. res.app is identical to the Request.app property in the request object.

  12. def append(field: String): Unit

    Permalink

    Appends the specified value to the HTTP response header field.

    Appends the specified value to the HTTP response header field. If the header is not already set, it creates the header with the specified value. The value parameter can be a string or an array. Note: calling Response.set() after Response.append() will reset the previously-set header value.

  13. def append(field: String, value: String): Unit

    Permalink

    Appends the specified value to the HTTP response header field.

    Appends the specified value to the HTTP response header field. If the header is not already set, it creates the header with the specified value. The value parameter can be a string or an array. Note: calling Response.set() after Response.append() will reset the previously-set header value.

  14. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  15. def attachment(): Unit

    Permalink

    Sets the HTTP response Content-Disposition header field to “attachment”.

    Sets the HTTP response Content-Disposition header field to “attachment”. If a filename is given, then it sets the Content-Type based on the extension name via res.type(), and sets the Content-Disposition “filename=” parameter.

  16. def attachment(filename: String): Unit

    Permalink

    Sets the HTTP response Content-Disposition header field to “attachment”.

    Sets the HTTP response Content-Disposition header field to “attachment”. If a filename is given, then it sets the Content-Type based on the extension name via res.type(), and sets the Content-Disposition “filename=” parameter.

  17. def clearCookie(name: String): Unit

    Permalink

    Clears the cookie specified by name.

    Clears the cookie specified by name. For details about the options object.

    See also

    Response.cookie()

  18. def clearCookie(name: String, options: CookieOptions): Unit

    Permalink

    Clears the cookie specified by name.

    Clears the cookie specified by name. For details about the options object.

    See also

    Response.cookie()

  19. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. def cookie(name: String, value: Any): Unit

    Permalink

    Sets cookie name to value.

    Sets cookie name to value. The value parameter may be a string or object converted to JSON.

  21. def cookie(name: String, value: Any, options: CookieOptions): Unit

    Permalink

    Sets cookie name to value.

    Sets cookie name to value. The value parameter may be a string or object converted to JSON.

  22. def cork(): Unit

    Permalink
    Definition Classes
    Writable
  23. var domain: String

    Permalink
    Definition Classes
    IEventEmitter
  24. def download(path: String): Unit

    Permalink

    Transfers the file at path as an “attachment”.

    Transfers the file at path as an “attachment”. Typically, browsers will prompt the user for download. By default, the Content-Disposition header “filename=” parameter is path (this typically appears in the browser dialog). Override this default with the filename parameter.

    When an error occurs or transfer is complete, the method calls the optional callback function fn. This method uses res.sendFile() to transfer the file.

  25. def download(path: String, filename: String): Unit

    Permalink

    Transfers the file at path as an “attachment”.

    Transfers the file at path as an “attachment”. Typically, browsers will prompt the user for download. By default, the Content-Disposition header “filename=” parameter is path (this typically appears in the browser dialog). Override this default with the filename parameter.

    When an error occurs or transfer is complete, the method calls the optional callback function fn. This method uses res.sendFile() to transfer the file.

  26. def download(path: String, filename: String, callback: Function): Unit

    Permalink

    Transfers the file at path as an “attachment”.

    Transfers the file at path as an “attachment”. Typically, browsers will prompt the user for download. By default, the Content-Disposition header “filename=” parameter is path (this typically appears in the browser dialog). Override this default with the filename parameter.

    When an error occurs or transfer is complete, the method calls the optional callback function fn. This method uses res.sendFile() to transfer the file.

  27. def emit(name: String, args: Any*): Any

    Permalink
    Definition Classes
    IEventEmitter
  28. def end(): Unit

    Permalink
    Definition Classes
    Writable
  29. def end(callback: Function1[Error, Any]): Unit

    Permalink
    Definition Classes
    Writable
  30. def end(chunk: String, callback: Function1[Error, Any]): Unit

    Permalink
    Definition Classes
    Writable
  31. def end(chunk: String, encoding: String): Unit

    Permalink
    Definition Classes
    Writable
  32. def end(chunk: String, encoding: String, callback: Function1[Error, Any]): Unit

    Permalink
    Definition Classes
    Writable
  33. def end(chunk: Buffer): Unit

    Permalink
    Definition Classes
    Writable
  34. def end(chunk: Buffer, callback: Function1[Error, Any]): Unit

    Permalink
    Definition Classes
    Writable
  35. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  36. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  37. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  38. def finished: Boolean

    Permalink
    Definition Classes
    ServerResponse
  39. def format(object: Any): Unit

    Permalink

    Performs content-negotiation on the Accept HTTP header on the request object, when present.

    Performs content-negotiation on the Accept HTTP header on the request object, when present. It uses req.accepts() to select a handler for the request, based on the acceptable types ordered by their quality values. If the header is not specified, the first callback is invoked. When no match is found, the server responds with 406 “Not Acceptable”, or invokes the default callback. The Content-Type response header is set when a callback is selected. However, you may alter this within the callback using methods such as res.set() or res.type().

  40. def get(field: String): UndefOr[String]

    Permalink

    Returns the HTTP response header specified by field.

    Returns the HTTP response header specified by field. The match is case-insensitive.

  41. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  42. def getHeader(name: String): UndefOr[String]

    Permalink
    Definition Classes
    ServerResponse
  43. def getMaxListeners(): Int

    Permalink
    Definition Classes
    IEventEmitter
  44. def hasOwnProperty(v: String): Boolean

    Permalink
    Definition Classes
    Object
  45. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  46. def headers: Dictionary[String]

    Permalink
    Definition Classes
    ServerResponse
  47. def headersSent: Boolean

    Permalink
    Definition Classes
    ServerResponse
  48. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  49. def isPaused(): Boolean

    Permalink
    Definition Classes
    Readable
  50. def isPrototypeOf(v: Object): Boolean

    Permalink
    Definition Classes
    Object
  51. def json(): Unit

    Permalink

    Sends a JSON response.

    Sends a JSON response. This method is identical to res.send() with an object or array as the parameter. However, you can use it to convert other values to JSON, such as null, and undefined (although these are technically not valid JSON).

  52. def json(body: Any): Unit

    Permalink

    Sends a JSON response.

    Sends a JSON response. This method is identical to res.send() with an object or array as the parameter. However, you can use it to convert other values to JSON, such as null, and undefined (although these are technically not valid JSON).

  53. def jsonp(): Unit

    Permalink

    Sends a JSON response with JSONP support.

    Sends a JSON response with JSONP support. This method is identical to res.json(), except that it opts-in to JSONP callback support.

  54. def jsonp(body: Any): Unit

    Permalink

    Sends a JSON response with JSONP support.

    Sends a JSON response with JSONP support. This method is identical to res.json(), except that it opts-in to JSONP callback support.

  55. def links(links: Any): Array[String]

    Permalink

    Joins the links provided as properties of the parameter to populate the response’s Link HTTP header field.

  56. def listenerCount(eventName: String): Int

    Permalink
    Definition Classes
    IEventEmitter
  57. def listeners(eventName: String): Array[Function]

    Permalink
    Definition Classes
    IEventEmitter
  58. def locals: Any

    Permalink

    An object that contains response local variables scoped to the request, and therefore available only to the view(s) rendered during that request / response cycle (if any).

    An object that contains response local variables scoped to the request, and therefore available only to the view(s) rendered during that request / response cycle (if any). Otherwise, this property is identical to app.locals.

    This property is useful for exposing request-level information such as the request path name, authenticated user, user settings, and so on.

  59. def location(path: String): Unit

    Permalink

    Sets the response Location HTTP header to the specified path parameter.

  60. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  61. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  62. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  63. def on(eventName: String, listener: Function): Response.this.type

    Permalink
    Definition Classes
    IEventEmitter
  64. def once(eventName: String, listener: Function): Response.this.type

    Permalink
    Definition Classes
    IEventEmitter
  65. def pause(): Response.this.type

    Permalink
    Definition Classes
    Readable
  66. def pipe(destination: Writable, options: |[ReadablePipeOptions, RawOptions]): Response.this.type

    Permalink
    Definition Classes
    Readable
  67. def propertyIsEnumerable(v: String): Boolean

    Permalink
    Definition Classes
    Object
  68. def push(chunk: Buffer): Boolean

    Permalink
    Definition Classes
    Readable
  69. def push(chunk: String, encoding: String): Boolean

    Permalink
    Definition Classes
    Readable
  70. def read[T](size: Int): T

    Permalink
    Definition Classes
    Readable
  71. def redirect(path: String): Unit

    Permalink

    Redirects to the URL derived from the specified path, with specified status, a positive integer that corresponds to an HTTP status code .

    Redirects to the URL derived from the specified path, with specified status, a positive integer that corresponds to an HTTP status code . If not specified, status defaults to “302 “Found”.

  72. def redirect(status: Int, path: String): Unit

    Permalink

    Redirects to the URL derived from the specified path, with specified status, a positive integer that corresponds to an HTTP status code .

    Redirects to the URL derived from the specified path, with specified status, a positive integer that corresponds to an HTTP status code . If not specified, status defaults to “302 “Found”.

  73. def removeAllListeners(): Response.this.type

    Permalink
    Definition Classes
    IEventEmitter
  74. def removeAllListeners(eventName: String): Response.this.type

    Permalink
    Definition Classes
    IEventEmitter
  75. def removeHeader(name: String): Unit

    Permalink
    Definition Classes
    ServerResponse
  76. def removeListener(eventName: String, listener: Function): Response.this.type

    Permalink
    Definition Classes
    IEventEmitter
  77. def render(view: String, locals: String): Unit

    Permalink

    Renders a view and sends the rendered HTML string to the client.

    Renders a view and sends the rendered HTML string to the client. Optional parameters:

    • locals, an object whose properties define local variables for the view.
    • callback, a callback function. If provided, the method returns both the possible error and rendered string, but does not perform an automated response. When an error occurs, the method invokes next(err) internally.
  78. def render(view: String, locals: String, callback: Function): Unit

    Permalink

    Renders a view and sends the rendered HTML string to the client.

    Renders a view and sends the rendered HTML string to the client. Optional parameters:

    • locals, an object whose properties define local variables for the view.
    • callback, a callback function. If provided, the method returns both the possible error and rendered string, but does not perform an automated response. When an error occurs, the method invokes next(err) internally.
  79. def render(path: String): Unit

    Permalink
    Definition Classes
    ServerResponse
  80. def resume(): Response.this.type

    Permalink
    Definition Classes
    Readable
  81. def send(): Unit

    Permalink

    Renders a view and sends the rendered HTML string to the client.

    Renders a view and sends the rendered HTML string to the client. Optional parameters:

    • locals, an object whose properties define local variables for the view.
    • callback, a callback function. If provided, the method returns both the possible error and rendered string, but does not perform an automated response. When an error occurs, the method invokes next(err) internally.
  82. def send(data: Any): Unit

    Permalink
    Definition Classes
    ServerResponse
  83. var sendDate: Boolean

    Permalink
    Definition Classes
    ServerResponse
  84. def sendFile(path: String): Unit

    Permalink

    Transfers the file at the given path.

    Transfers the file at the given path. Sets the Content-Type response HTTP header field based on the filename’s extension. Unless the root option is set in the options object, path must be an absolute path to the file.

  85. def sendFile(path: String, options: FileTransferOptions): Unit

    Permalink

    Transfers the file at the given path.

    Transfers the file at the given path. Sets the Content-Type response HTTP header field based on the filename’s extension. Unless the root option is set in the options object, path must be an absolute path to the file.

  86. def sendFile(path: String, options: FileTransferOptions, callback: Function): Unit

    Permalink

    Transfers the file at the given path.

    Transfers the file at the given path. Sets the Content-Type response HTTP header field based on the filename’s extension. Unless the root option is set in the options object, path must be an absolute path to the file.

  87. def sendStatus(statusCode: Int): Unit

    Permalink
    Definition Classes
    ServerResponse
  88. def set(name: String, value: String): Unit

    Permalink

    Sets the response’s HTTP header field to value.

    Sets the response’s HTTP header field to value. To set multiple fields at once, pass an object as the parameter.

  89. def set(headers: Any): Unit

    Permalink
    Definition Classes
    ServerResponse
  90. def set(name: String, value: Any): Unit

    Permalink
    Definition Classes
    ServerResponse
  91. def setDefaultEncoding(encoding: String): Response.this.type

    Permalink
    Definition Classes
    Writable
  92. def setEncoding(encoding: String): Response.this.type

    Permalink
    Definition Classes
    Readable
  93. def setHeader(name: String, value: String): Unit

    Permalink
    Definition Classes
    ServerResponse
  94. def setMaxListeners(n: Int): Response.this.type

    Permalink
    Definition Classes
    IEventEmitter
  95. def setTimeout(msecs: Int, callback: Function): Unit

    Permalink
    Definition Classes
    ServerResponse
  96. def status(statusCode: Int): Response.this.type

    Permalink
    Definition Classes
    ServerResponse
  97. var statusCode: Int

    Permalink
    Definition Classes
    ServerResponse
  98. var statusMessage: UndefOr[String]

    Permalink
    Definition Classes
    ServerResponse
  99. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  100. def toLocaleString(): String

    Permalink
    Definition Classes
    Object
  101. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  102. def type(mime: String): UndefOr[String]

    Permalink
    Definition Classes
    ServerResponse
  103. def uncork(): Unit

    Permalink
    Definition Classes
    Writable
  104. def unpipe(destination: Writable): Unit

    Permalink
    Definition Classes
    Readable
  105. def unshift(chunk: Any): Unit

    Permalink
    Definition Classes
    Readable
  106. var usingDomains: Boolean

    Permalink
    Definition Classes
    IEventEmitter
  107. def valueOf(): Any

    Permalink
    Definition Classes
    Object
  108. def vary(field: String): Response.this.type

    Permalink

    Adds the field to the Vary response header, if it is not there already.

  109. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  110. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  111. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  112. def wrap(stream: Any): Unit

    Permalink
    Definition Classes
    Readable
  113. def write(chunk: Buffer, callback: Function1[Error, Any]): Boolean

    Permalink
    Definition Classes
    Writable
  114. def write(chunk: String, callback: Function1[Error, Any]): Boolean

    Permalink
    Definition Classes
    Writable
  115. def write(chunk: String, encoding: String, callback: Function1[Error, Any]): Boolean

    Permalink
    Definition Classes
    Writable
  116. def writeContinue(): Unit

    Permalink
    Definition Classes
    ServerResponse
  117. def writeHead(statusCode: Int, headers: Any): Unit

    Permalink
    Definition Classes
    ServerResponse
  118. def writeHead(statusCode: Int, statusMessage: String): Unit

    Permalink
    Definition Classes
    ServerResponse
  119. def writeHead(statusCode: Int, statusMessage: String, headers: Any): Unit

    Permalink
    Definition Classes
    ServerResponse

Inherited from ServerResponse

Inherited from IDuplex

Inherited from Writable

Inherited from Readable

Inherited from IEventEmitter

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped