Commit graph

91 commits

Author SHA1 Message Date
dead-horse
d4bdb5ed9e chore: update eslint and fix lint errors 2019-06-26 11:15:22 +08:00
Martin Iwanowski
b7bfa7113b feat: change set status assert, allowing valid custom statuses (#1308) 2019-01-28 16:50:27 +08:00
Mikhail Bodrov
d9ef60398e chore: Optimize array split (#1295) 2019-01-03 20:48:31 +08:00
jeremiG
9be8583125 chore: replace ~~ with Math.trunc in res.length (option) (#1288) 2018-12-27 16:22:35 +08:00
小雷
9146024e10 feat: response.attachment append a parameter: options from contentDisposition (#1240) 2018-10-08 22:43:11 +08:00
Yiyu He
0b930665a8
perf: avoid stringify when set header (#1220) 2018-07-12 14:10:12 +08:00
Yiyu He
c6b8782553 perf: cache content type's result (#1218) 2018-07-11 17:49:25 +08:00
Ruben Bridgewater
8f047ddb84 fix: use non deprecated custom inspect (#1198)
Custom inspection with the `inspect` property is deprecated and will
not work in Node.js 11 anymore. This fixes it by using the custom
inspect symbol where existent and falls back to the old style in case
it does not exist.
2018-06-25 10:34:15 +08:00
initial-wu
148f26f630 chore: use this.res.socket insteadof this.ctx.req.socket (#1177)
prefer a shorter path to the object
2018-04-27 23:51:47 +08:00
Yiyu He
3c23aa5b74
feat: ignore set header/status when header sent (#1137) 2018-02-11 16:25:24 +08:00
Bernie Stern
6029064756 HTTP/2 has no status message (#1048) (#1049) 2017-11-06 12:17:43 +00:00
ziyunfei
13c7ca6139 res.type=: remove no-op code (#980) 2017-05-05 10:27:11 -07:00
jongleberry
e9d7abaf79 res: use http.ServerResponse._header when accessors exist (#930)
* Don't use http.ServerResponse._header when accessors exist

Structure of http.ServerResponse._header will change in future
Node versions. Avoid reading and setting it directly when
helpers exist.

* Add new header test case

* make things a little more strict
2017-03-07 22:59:24 -08:00
Yiyu He
4338cb6c14 [breaking change] don't bind onerror to context (#800) 2016-08-29 11:18:30 +08:00
jongleberry
2abed6ec75 fix: res.flushHeaders() (#795)
* fix: res.flushHeaders()

* remove arg to flush headers

* fix tests for node v4 and v5
2016-08-10 12:15:48 -07:00
Yiyu He
23903e7ef4 fix(response): correct response.writable logic (#782) 2016-07-24 01:20:29 +08:00
Bartol Karuza
3d15c2409d JSDoc question/suggestion on optional parameters
Hi, Webstorm keeps giving me warnings on the 'redirect' method, because the JSDoc specified two input parameters, both required. There is a JSDoc standard for optional parameters. What is your view on using these in KOA documentation?
http://usejsdoc.org/tags-param.html#optional-parameters-and-default-values

closes #661
2016-03-12 14:22:42 -08:00
Louis DeScioli
d74802dc70 Standardizes instances of removeHeader to remove 2016-03-12 14:19:27 -08:00
jongleberry
7373c7eca1 comments: remove vague TODOs
closes #576
2016-03-12 14:11:19 -08:00
Lee Bousfield
6a147726bd Add support for flushing headers 2016-03-03 21:01:56 -07:00
pana
1e38b13a94 docs: update docs for koa v2
update readme and request, response toJSON method

update readme

update readme

update readme

update readme

update readme

update readme

update docs

update doc

pretty readme

update docs

fix then callback
2016-01-17 16:05:49 -08:00
Slobodan Stojanovic
0470997854 Remove 'TODO' comment for this.res._headers
Node probably doesn't plan to change this so there's no point of having 'TODO' comment in the code.
2015-10-31 19:21:40 +01:00
Slobodan Stojanovic
b08facb7bd Fix indentation and add .eslint rules
closes #555
2015-10-29 09:55:34 -07:00
jongleberry
16db0f60c4 eslint: add no-var rule 2015-10-22 15:46:47 -07:00
Santiago Sotomayor
0c438ed435 unset content-type when the type is unknown
closes #532
closes #536
2015-10-22 15:39:16 -07:00
Robert Sköld
e900f0a44a Use shorthand functions
closes #519
2015-10-12 00:00:41 -07:00
Tejas Manohar
ed19e67055 refactor to use ES6 template strings
replace string interp w/ templates in core

use string templating es6 in benchmarks

template strings in tests dir
2015-10-11 21:22:33 -07:00
Tejas Manohar
9f27c1c414 refactor to use ES6 const
change var to const for static require()'d modules

make constant var references in app use const keyword

refactor context to use es6 constants

refactor request to use es6 constants, let block-scope coming next

use const in response object for static refs

make context tests use es6 constants

experimental unit tests -> const

use const for static references in unit test over req

use const for static refs in res tests

update app tests to use const for static refs

make the context test use es6 constants for static refs

use constants in the README
es6 constants seem to work in --harmony on 0.12 too

use const's for immutable refs in benchmarks

ensure all JS files have blank newline at top

add newline to bottom of file where missing

add a webchat freenode link to irc channel

no need to assign error in catch{}-able test

app.silent option to turn off err logging

keep test env logging for backwards-compat
2015-10-11 21:22:33 -07:00
Tejas Manohar
0b1b49cb8a use strict in all .js files
closes #508
2015-10-11 16:08:32 -07:00
dead_horse
36a933375b fix comment 2015-08-25 16:49:05 +08:00
dead_horse
c8eb5eefb1 make sure helpers return strict string 2015-04-29 01:44:02 +08:00
dead_horse
1c5cb6f691 feat: alias response.headers to response.header 2015-04-23 17:28:31 +08:00
Jesus Rodriguez
68843e0cb3 Remove unused imports and exports 2015-01-29 15:39:06 -08:00
TJ Holowaychuk
255a39b876 refactor res.append()
OCDOCDOCD
2015-01-27 10:14:57 -08:00
dead_horse
5a3f32dfdd Add res.append(field, val) to append headers 2015-01-26 02:20:08 +08:00
zensh
28ec7892a8 remove unnecessary "require('http')" 2014-11-29 09:42:01 +08:00
dead_horse
57eb6a10df set content-type for redirect when accpect plain 2014-11-27 09:25:44 -08:00
dead_horse
eff4886cd8 ocd 2014-11-16 21:52:14 +08:00
dead_horse
efdd7d3716 less strict for status, close #350
add res.message[=]
2014-10-09 23:20:53 +08:00
fengmk2
cca2438f64 ctx.attachment support no-ascii filename 2014-09-19 13:46:08 +08:00
Jonathan Ong
9455726c00 finished -> on-finished
removes the writable test because it’s fake and there are tests for
on-finished for this case
2014-08-16 02:58:06 -07:00
Jonathan Ong
920909c546 dethroy -> destroy 2014-08-14 23:34:25 -07:00
Jonathan Ong
31ba115231 res: add .is() 2014-06-13 00:30:59 -07:00
TJ Holowaychuk
696d55d73b refactor res.status= 2014-06-10 14:33:13 -07:00
TJ Holowaychuk
ed8beb7d79 Merge pull request #299 from tmilewski/remove-status-as-string
remove .status=string
2014-06-10 14:32:13 -07:00
TJ Holowaychuk
71536b35be remove res.statusString 2014-06-10 14:31:41 -07:00
tmilewski
c2322f2b3d remove .status=string #298 2014-06-10 16:38:25 -04:00
Jonathan Ong
dc59a604e5 Merge pull request #292 from koajs/context-delegate
context: delegate etag/last-modified
2014-06-07 03:39:19 -07:00
TJ Holowaychuk
63a4297084 Merge pull request #291 from koajs/vary
remove response.append(), use vary module
2014-06-06 23:00:39 -07:00
Jonathan Ong
1a32ecac31 fix res.type= for unknown types
because we changed from mime to mime-types. ideally, we should just not
set the content-type, but this way it’s backwards compatible. we can
change it later.
2014-06-06 16:26:03 -07:00