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, Writable, IEventEmitter, Object, Any, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Response
  2. ServerResponse
  3. Writable
  4. IEventEmitter
  5. Object
  6. Any
  7. AnyRef
  8. 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 addListener(eventName: String, listener: Function): Response.this.type

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

    Permalink
    Definition Classes
    ServerResponse
  6. 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.

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

  8. 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.

  9. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  10. 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.

  11. 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.

  12. 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()

  13. 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()

  14. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  15. 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.

  16. 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.

  17. def cork(): Unit

    Permalink
    Definition Classes
    Writable
  18. var domain: String

    Permalink
    Definition Classes
    IEventEmitter
  19. 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.

  20. 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.

  21. 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.

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

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

    Permalink
    Definition Classes
    Writable
  24. def end(callback: Function): Unit

    Permalink
    Definition Classes
    Writable
  25. def end(chunk: |[String, Buffer], callback: Function): Unit

    Permalink
    Definition Classes
    Writable
  26. def end(chunk: |[String, Buffer], encoding: String): Unit

    Permalink
    Definition Classes
    Writable
  27. def end(chunk: |[String, Buffer], encoding: String, callback: Function): Unit

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

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

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

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

    Permalink
    Definition Classes
    ServerResponse
  32. 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().

  33. 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.

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

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

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

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

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

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

    Permalink
    Definition Classes
    ServerResponse
  40. def headersSent: Boolean

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

    Permalink
    Definition Classes
    Any
  42. def isPrototypeOf(v: Object): Boolean

    Permalink
    Definition Classes
    Object
  43. 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).

  44. 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).

  45. 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.

  46. 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.

  47. 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.

  48. def listenerCount(eventName: String): Int

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

    Permalink
    Definition Classes
    IEventEmitter
  50. 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.

  51. def location(path: String): Unit

    Permalink

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

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

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

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

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

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

    Permalink
    Definition Classes
    IEventEmitter
  57. def propertyIsEnumerable(v: String): Boolean

    Permalink
    Definition Classes
    Object
  58. 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”.

  59. 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”.

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

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

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

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

    Permalink
    Definition Classes
    IEventEmitter
  64. 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.
  65. 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.
  66. def render(path: String): Unit

    Permalink
    Definition Classes
    ServerResponse
  67. 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.
  68. def send(data: Any): Unit

    Permalink
    Definition Classes
    ServerResponse
  69. var sendDate: Boolean

    Permalink
    Definition Classes
    ServerResponse
  70. 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.

  71. 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.

  72. 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.

  73. def sendStatus(statusCode: Int): Unit

    Permalink
    Definition Classes
    ServerResponse
  74. 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.

  75. def set(headers: Any): Unit

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

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

    Permalink
    Definition Classes
    Writable
  78. def setEncoding(encoding: String): Unit

    Permalink
    Definition Classes
    ServerResponse
  79. def setHeader(name: String, value: String): Unit

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

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

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

    Permalink
    Definition Classes
    ServerResponse
  83. var statusCode: Int

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

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

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

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

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

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

    Permalink
    Definition Classes
    Writable
  90. var usingDomains: Boolean

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

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

    Permalink

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

  93. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  96. def write(chunk: |[String, Buffer], encoding: String): Boolean

    Permalink
    Definition Classes
    Writable
  97. def write(chunk: |[String, Buffer], encoding: String, callback: Function): Boolean

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

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

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

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

    Permalink
    Definition Classes
    ServerResponse

Inherited from ServerResponse

Inherited from Writable

Inherited from IEventEmitter

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped