### Type parameters

- #### ResBody = any

### Hierarchy

- Response
  - OpineResponse

### Implemented by

- Response

## Index

### Properties

- app
- body
- headers
- json
- jsonp
- locals
- req
- send
- status
- statusMessage
- statusText
- written

### Methods

- addResource
- append
- attachment
- clearCookie
- cookie
- download
- end
- etag
- format
- get
- links
- location
- redirect
- removeHeader
- render
- sendFile
- sendStatus
- set
- setHeader
- setStatus
- type
- unset
- vary

## Properties

### app

app: Application

- Defined in home/runner/work/opine/opine/src/types.ts:648

### Optional body

body: Uint8Array | Deno.Reader | string | ReadableStream

- Defined in home/runner/work/opine/opine/src/types.ts:646

### Optional headers

headers: Headers

- Defined in home/runner/work/opine/opine/src/types.ts:645

### json

json: Send<ResBody, this>

- Defined in home/runner/work/opine/opine/src/types.ts:812

Send JSON response.

Examples:

    res.json(null);
    res.json({ user: 'deno' });
    res.setStatus(500).json('oh noes!');
    res.setStatus(404).json(`I don't have that`);

### jsonp

jsonp: Send<ResBody, this>

- Defined in home/runner/work/opine/opine/src/types.ts:824

Send JSON response with JSONP callback support.

Examples:

    res.jsonp(null);
    res.jsonp({ user: 'deno' });
    res.setStatus(500).jsonp('oh noes!');
    res.setStatus(404).jsonp(`I don't have that`);

### locals

locals: any

- Defined in home/runner/work/opine/opine/src/types.ts:652

### Optional req

req: OpineRequest

- Defined in home/runner/work/opine/opine/src/types.ts:650

### send

send: Send<ResBody, this>

- Defined in home/runner/work/opine/opine/src/types.ts:925

Send a response.

Examples:

    res.send(new Buffer('wahoo'));
    res.send({ some: 'json' });
    res.send('<p>some html</p>');
    res.setStatus(404).send('Sorry, cant find that');

### Optional status

status: number

- Defined in home/runner/work/opine/opine/src/types.ts:643

### Optional statusMessage

statusMessage: any

- Defined in home/runner/work/opine/opine/src/types.ts:654

### Optional statusText

statusText: string

- Defined in home/runner/work/opine/opine/src/types.ts:644

### written

written: boolean

- Defined in home/runner/work/opine/opine/src/types.ts:659

Boolean signifying whether the request has already been responded to.

## Methods

### addResource

- addResource(rid: number): void

- - Defined in home/runner/work/opine/opine/src/types.ts:665

  Add a resource ID to the list of resources to be closed after the .end() method has been called.

  #### Parameters

  - ##### rid: number

  #### Returns void

### append

- append(field: string, value: string | string[]): this

- - Defined in home/runner/work/opine/opine/src/types.ts:680

  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.

  Example:

  res.append('Set-Cookie', 'foo=bar; Path=/; HttpOnly'); res.append('Warning', '199 Miscellaneous warning'); res.append("cache-control", ["public", "max-age=604800", "immutable"]);

  Note: calling res.set() after res.append() will reset the previously-set header value.

  #### Parameters

  - ##### field: string

  - ##### value: string | string[]

  #### Returns this

### attachment

- attachment(filename?: string): this

- - Defined in home/runner/work/opine/opine/src/types.ts:685

  Set Content-Disposition header to attachment with optional `filename`.

  #### Parameters

  - ##### Optional filename: string

  #### Returns this

### clearCookie

- clearCookie(name: string, options?: CookieOptions): this
- clearCookie(cookie: CookieWithOptionalValue): this

- - Defined in home/runner/work/opine/opine/src/types.ts:699

  Clear cookie by `name`.

  #### Parameters

  - ##### name: string

  - ##### Optional options: CookieOptions

  #### Returns this

- - Defined in home/runner/work/opine/opine/src/types.ts:704

  Clear the provided cookie.

  #### Parameters

  - ##### cookie: CookieWithOptionalValue

  #### Returns this

### cookie

- cookie(cookie: DenoCookie): this
- cookie(name: string, value: string, options?: CookieOptions): this

- - Defined in home/runner/work/opine/opine/src/types.ts:695

  Sets a cookie.

  Examples:

  // "Remember Me" for 15 minutes res.cookie({ name: "rememberme", value: "1", expires: new Date(Date.now() + 900000), httpOnly: true });

  #### Parameters

  - ##### cookie: DenoCookie

  #### Returns this

- - Defined in home/runner/work/opine/opine/src/types.ts:696

  #### Parameters

  - ##### name: string

  - ##### value: string

  - ##### Optional options: CookieOptions

  #### Returns this

### download

- download(path: string): Promise<this | void>
- download(path: string, filename: string): Promise<this | void>
- download(path: string, filename: string, options: any): Promise<this | void>

- - Defined in home/runner/work/opine/opine/src/types.ts:719

  Transfer the file at the given `path` as an attachment.

  Optionally providing an alternate attachment `filename`.

  Optionally providing an `options` object to use with `res.sendFile()`.

  This function will set the `Content-Disposition` header, overriding any existing `Content-Disposition` header in order to set the attachment and filename.

  This method uses `res.sendFile()`.

  #### Parameters

  - ##### path: string

  #### Returns Promise<this | void>

- - Defined in home/runner/work/opine/opine/src/types.ts:720

  #### Parameters

  - ##### path: string

  - ##### filename: string

  #### Returns Promise<this | void>

- - Defined in home/runner/work/opine/opine/src/types.ts:721

  #### Parameters

  - ##### path: string

  - ##### filename: string

  - ##### options: any

  #### Returns Promise<this | void>

### end

- end(): Promise<void>
- end(body: DenoResponseBody): Promise<void>

- - Defined in home/runner/work/opine/opine/src/types.ts:742

  Ends a response.

  Generally it is recommended to use the `res.send()` or `res.json()` methods which will handle automatically setting the Content-Type header, and are able to gracefully handle a greater range of body inputs.

  Examples:

      res.end();
      res.end('<p>some html</p>');
      res.setStatus(404).end('Sorry, cant find that');

  #### Returns Promise<void>

- - Defined in home/runner/work/opine/opine/src/types.ts:743

  #### Parameters

  - ##### body: DenoResponseBody

  #### Returns Promise<void>

### etag

- etag(chunk: string | Uint8Array | Deno.FileInfo): this

- - Defined in home/runner/work/opine/opine/src/types.ts:726

  Sets an ETag header.

  #### Parameters

  - ##### chunk: string | Uint8Array | Deno.FileInfo

  #### Returns this

### format

- format(obj: any): this

- - Defined in home/runner/work/opine/opine/src/types.ts:797

  Respond to the Acceptable formats using an `obj` of mime-type callbacks.

  This method uses `req.accepted`, an array of acceptable types ordered by their quality values. When "Accept" is not present the first callback is invoked, otherwise the first match is used. When no match is performed the server responds with 406 "Not Acceptable".

  Content-Type is set for you, however if you choose you may alter this within the callback using `res.type()` or `res.set('Content-Type', ...)`.

  res.format({ 'text/plain': function(){ res.send('hey'); },

       'text/html': function(){
         res.send('<p>hey</p>');
       },

       'application/json': function(){
         res.send({ message: 'hey' });
       }

  });

  In addition to canonicalized MIME types you may also use extnames mapped to these types:

  res.format({ text: function(){ res.send('hey'); },

       html: function(){
         res.send('<p>hey</p>');
       },

       json: function(){
         res.send({ message: 'hey' });
       }

  });

  By default Express passes an `Error` with a `.status` of 406 to `next(err)` if a match is not made. If you provide a `.default` callback it will be invoked instead.

  #### Parameters

  - ##### obj: any

  #### Returns this

### get

- get(field: string): string

- - Defined in home/runner/work/opine/opine/src/types.ts:800

  Get value for header `field`.

  #### Parameters

  - ##### field: string

  #### Returns string

### links

- links(links: any): this

- - Defined in home/runner/work/opine/opine/src/types.ts:836

  Set Link header field with the given `links`.

  Examples:

  res.links({ next: 'http://api.example.com/users?page=2', last: 'http://api.example.com/users?page=5' });

  #### Parameters

  - ##### links: any

  #### Returns this

### location

- location(url: string): this

- - Defined in home/runner/work/opine/opine/src/types.ts:864

  Set the location header to `url`.

  The given `url` can also be the name of a mapped url, for example by default express supports "back" which redirects to the Referrer or Referer headers or "/".

  Examples:

  res.location('/foo/bar').; res.location('http://example.com'); res.location('../login'); // /blog/post/1 -> /blog/login

  Mounting:

  When an application is mounted and `res.location()` is given a path that does not lead with "/" it becomes relative to the mount-point. For example if the application is mounted at "/blog", the following would become "/blog/login".

       res.location('login');

  While the leading slash would result in a location of "/login":

       res.location('/login');

  #### Parameters

  - ##### url: string

  #### Returns this

### redirect

- redirect(url: string): void
- redirect(code: Status, url: string): void

- - Defined in home/runner/work/opine/opine/src/types.ts:883

  Redirect to the given `url` with optional response `status` defaulting to `302`.

  The resulting `url` is determined by `res.location()`.

  Examples:

  res.redirect('/foo/bar'); res.redirect('http://example.com'); res.redirect(301, 'http://example.com'); res.redirect('../login'); // /blog/post/1 -> /blog/login

  #### Parameters

  - ##### url: string

  #### Returns void

- - Defined in home/runner/work/opine/opine/src/types.ts:884

  #### Parameters

  - ##### code: Status

  - ##### url: string

  #### Returns void

### removeHeader

- removeHeader(field: string): this

- - Defined in home/runner/work/opine/opine/src/types.ts:896

  Remove a header from the response

  Examples:

      res.removeHeader('Accept');

  #### Parameters

  - ##### field: string

  #### Returns this

  for chaining

### render

- render(view: string, options?: Record<string, unknown>, callback?: (err: Error, html: string) => void): void
- render(view: string, callback?: (err: Error, html: string) => void): void

- - Defined in home/runner/work/opine/opine/src/types.ts:908

  Render `view` with the given `options` and optional callback `fn`. When a callback function is given a response will not be made automatically, otherwise a response of 200 and text/html is given.

  Options:

  - `cache` boolean hinting to the engine it should cache
  - `filename` filename of the view being rendered

  #### Parameters

  - ##### view: string

  - ##### Optional options: Record<string, unknown>

  - ##### Optional callback: (err: Error, html: string) => void

    - - (err: Error, html: string): void

      - #### Parameters

        - ##### err: Error

        - ##### html: string

        #### Returns void

- - Defined in home/runner/work/opine/opine/src/types.ts:913

  #### Parameters

  - ##### view: string

  - ##### Optional callback: (err: Error, html: string) => void

    - - (err: Error, html: string): void

      - #### Parameters

        - ##### err: Error

        - ##### html: string

        #### Returns void

### sendFile

- sendFile(path: string, options?: any): Promise<this | void>

- - Defined in home/runner/work/opine/opine/src/types.ts:952

  Transfer the file at the given `path`.

  Automatically sets the Content-Type response header field.

  Examples:

  The following example illustrates how `res.sendFile()` may be used as an alternative for the `static()` middleware for dynamic situations. The code backing `res.sendFile()` is actually the same code, so HTTP cache support etc is identical.

      app.get('/user/:uid/photos/:file', function(req, res){
        const uid = req.params.uid;
        const file = req.params.file;

        req.user.mayViewFilesFrom(uid, function(yes) {
          if (yes) {
            res.sendFile('/uploads/' + uid + '/' + file);
          } else {
            res.send(403, 'Sorry! you cant see that.');
          }
        });
      });

  #### Parameters

  - ##### path: string

  - ##### Optional options: any

  #### Returns Promise<this | void>

### sendStatus

- sendStatus(code: Status): this

- - Defined in home/runner/work/opine/opine/src/types.ts:964

  Set the response HTTP status code to `statusCode` and send its string representation as the response body.

  Examples:

  res.sendStatus(200); // equivalent to res.setStatus(200).send('OK') res.sendStatus(403); // equivalent to res.setStatus(403).send('Forbidden') res.sendStatus(404); // equivalent to res.setStatus(404).send('Not Found') res.sendStatus(500); // equivalent to res.setStatus(500).send('Internal Server Error')

  #### Parameters

  - ##### code: Status

  #### Returns this

### set

- set(field: string, value: string): this
- set(obj: Record<string, string>): this

- - Defined in home/runner/work/opine/opine/src/types.ts:978

  Set header `field` to `val`, or pass an object of header fields.

  Examples:

      res.set('Accept', 'application/json');
      res.set({
        'Accept-Language': en-US, en;q=0.5,
        'Accept': 'text/html',
      });

  #### Parameters

  - ##### field: string

  - ##### value: string

  #### Returns this

- - Defined in home/runner/work/opine/opine/src/types.ts:979

  #### Parameters

  - ##### obj: Record<string, string>

  #### Returns this

### setHeader

- setHeader(field: string, value: string): this
- setHeader(obj: Record<string, string>): this

- - Defined in home/runner/work/opine/opine/src/types.ts:999

  Set header `field` to `value`, or pass an object of header fields.

  alias for res.set()

  Examples:

      res.setHeader('Accept', 'application/json');
      res.setHeader({
        'Accept-Language': "en-US, en;q=0.5",
        'Accept': 'text/html',
      });

  #### Parameters

  - ##### field: string

  - ##### value: string

  #### Returns this

  for chaining

- - Defined in home/runner/work/opine/opine/src/types.ts:1000

  #### Parameters

  - ##### obj: Record<string, string>

  #### Returns this

### setStatus

- setStatus(code: Status): this

- - Defined in home/runner/work/opine/opine/src/types.ts:1005

  Set status `code`.

  #### Parameters

  - ##### code: Status

  #### Returns this

### type

- type(type: string): this

- - Defined in home/runner/work/opine/opine/src/types.ts:1018

  Set Content-Type response header with `type`.

  Examples:

      res.type('.html');
      res.type('html');
      res.type('json');
      res.type('application/json');
      res.type('png');

  #### Parameters

  - ##### type: string

  #### Returns this

### unset

- unset(field: string): this

- - Defined in home/runner/work/opine/opine/src/types.ts:1027

  Removes the header `field`.

  Examples:

  res.unset('Accept');

  #### Parameters

  - ##### field: string

  #### Returns this

### vary

- vary(field: string): this

- - Defined in home/runner/work/opine/opine/src/types.ts:1035

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

      res.vary('User-Agent').render('docs');

  #### Parameters

  - ##### field: string

  #### Returns this

Generated using TypeDoc