Skip to content

Commit

Permalink
Revert "add response.charset accessor and ctx.charset alias"
Browse files Browse the repository at this point in the history
This reverts commit 94413b1.
  • Loading branch information
tj committed Mar 7, 2014
1 parent c50012a commit b1f0abd
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 85 deletions.
6 changes: 2 additions & 4 deletions docs/api/context.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,10 @@ throw err;
- `ctx.body=`
- `ctx.status`
- `ctx.status=`
- `ctx.length`
- `ctx.length=`
- `ctx.type`
- `ctx.length`
- `ctx.type=`
- `ctx.charset`
- `ctx.charset=`
- `ctx.type`
- `ctx.headerSent`
- `ctx.redirect()`
- `ctx.attachment()`
Expand Down
14 changes: 0 additions & 14 deletions docs/api/response.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,6 @@ this.type = 'png';
when explicitly defined in full as `res.type = 'text/html'`
no charset is assigned.

### res.charset

Get response charset when present, or `undefined`:

```js
this.type = 'text/plain; charset=utf-8';
this.charset
// => "utf-8"
```

### res.charset=

Set the response charset, overriding if present.

### res.redirect(url, [alt])

Perform a [302] redirect to `url`.
Expand Down
1 change: 0 additions & 1 deletion lib/context.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ delegate(proto, 'response')
.access('body')
.access('length')
.access('type')
.access('charset')
.getter('headerSent')
.getter('writable')
.setter('lastModified')
Expand Down
25 changes: 0 additions & 25 deletions lib/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,6 @@ var extname = path.extname;

module.exports = {

/**
* Set the charset.
*
* @param {String} val
* @api public
*/

set charset(val) {
this.set('Content-Type', this.type + '; charset=' + val);
},

/**
* Get the charset when present or undefined.
*
* @return {String}
* @api public
*/

get charset() {
// TODO: lame, we could have a generic param parsing lib
var type = this.get('Content-Type');
var m = type.match(/charset *= *(\S+)/);
if (m) return m[1];
},

/**
* Return the request socket.
*
Expand Down
41 changes: 0 additions & 41 deletions test/response/charset.js

This file was deleted.

0 comments on commit b1f0abd

Please sign in to comment.