Commit graph

51 commits

Author SHA1 Message Date
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
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
Yu Qi
c979056087 fix tests on node 6
parsed querystrings no longer inherit from the Object prototype
2016-04-30 09:19:29 +02:00
Lee Bousfield
6a147726bd Add support for flushing headers 2016-03-03 21:01:56 -07:00
broucz
4b1a1da652 test: switch all functions to arrow functions
closes #553

Update test: application -> use() should throw if not a function

Fix lint

Use arrow function

Refactor test using arrow function

Remove non mandatory brackets

fix for merge

Fix: missing refactor after merge

Use arrow function for old generator
2015-11-02 11:22:05 -08:00
Slobodan Stojanovic
275356a5ce Remove TODO from the response type test 2015-10-31 14:01:26 +01:00
Slobodan Stojanovic
b08facb7bd Fix indentation and add .eslint rules
closes #555
2015-10-29 09:55:34 -07:00
Felix Becker
ebb4850709 Remove co dependency
closes #558
closes #557

Change tests to use plain functions and promises

Add test

return promise in middleware

Change benchmarks to use plain functions and promises

typeerror
2015-10-27 16:24:25 -07:00
jongleberry
2e8cdab8bc support async functions
closes #530
closes #415
2015-10-22 16:34:59 -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
Michaël Zasso
b5c09a1719 test: fix style issues 2015-10-13 09:23:57 +02:00
Tejas Manohar
93ade5e2dd refactor Application into a class 2015-10-13 01:19:42 -05:00
Tejas Manohar
e8f79d43f9 modularize tests for application
closes #517

add index test for Application

add app.toJSON test

add test for app.inspect()

add tests for app.use()

add tests for app.onerror()

add tests for app.respond()

add tests for app.context()

add tests for app.request()

add tests for app.response

refactor for non-existence of test/app...js

no need for *.js

use helpers/ dir for non-tests
2015-10-12 00:08:06 -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
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
fengmk2
1edd6ec69a test: improve test coverage for application and response 2015-03-29 14:40:09 +08:00
Jesús Rodríguez Rodríguez
8d1a340789 Fix typo on response.body test.
Just a small typo.
2015-01-29 15:39:06 -08:00
dead_horse
5a3f32dfdd Add res.append(field, val) to append headers 2015-01-26 02:20:08 +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
TJ Holowaychuk
eb443d1bee Merge pull request #353 from dead-horse/status
custom status
2014-10-09 09:05:26 -07:00
dead_horse
efdd7d3716 less strict for status, close #350
add res.message[=]
2014-10-09 23:20:53 +08:00
dead_horse
065a773e65 more test case 2014-10-01 20:42:29 +08:00
fengmk2
cca2438f64 ctx.attachment support no-ascii filename 2014-09-19 13:46:08 +08:00
Tiago Ribeiro
a85f580983 Add full coverage 2014-09-08 23:53:46 +01:00
dead_horse
e791100993 add more test case, fix req.idempotent 2014-07-06 16:52:02 +08:00
Jonathan Ong
31ba115231 res: add .is() 2014-06-13 00:30:59 -07:00
tmilewski
c2322f2b3d remove .status=string #298 2014-06-10 16:38:25 -04: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
Jonathan Ong
008f0554c6 set-type -> mime-types
removes mime dependencies from the dep tree.
liberally sets charset because some express users complained about bad
browsers using the default charset.
2014-06-03 21:44:25 -07:00
dead_horse
48ac0669c5 fix content-length when body is re-assigned. Closes #267 2014-04-28 20:34:26 -07:00
dead_horse
64aad129d3 fix this.status= in this.body
fix default status set bug in this.body=null.
do not call this.status= if this.status exist.
make sure empty content status remove content headers
2014-04-10 11:47:30 +08:00
TJ Holowaychuk
3d8ab61fa1 change res.type= to always default charset. Closes #252 2014-04-09 09:34:50 -07:00
Dmitry Mazuro
9e8d6a3aa0 ocd 2014-03-24 21:21:15 +03:00
TJ Holowaychuk
b1f0abd16d Revert "add response.charset accessor and ctx.charset alias"
This reverts commit 94413b1bd4.
2014-03-06 18:05:01 -08:00
TJ Holowaychuk
94413b1bd4 add response.charset accessor and ctx.charset alias 2014-02-14 09:33:10 -08:00
TJ Holowaychuk
08149052fa change ctx.length and ctx.type to always delegate to response object [breaking change] 2014-02-14 09:16:39 -08:00
Jonathan Ong
c7ff0e2ac1 response.body: fix html content sniffing for strings
closes #214
2014-02-13 18:35:25 -08:00
TJ Holowaychuk
70971dcb53 add GeneratorFunction assertion for app.use(). Closes #120
breaks old old shit but thats ok, super early in the game
2013-12-19 10:03:08 -08:00
TJ Holowaychuk
8e10f12d38 add ctx.remove() and res.remove(). Closes #100 2013-11-24 05:06:35 -08:00
TJ Holowaychuk
d9940c1931 fix 2 test requires 2013-11-14 11:23:59 -08:00
TJ Holowaychuk
64fa0b5c2a Merge pull request #85 from koajs/expose-proto
Expose proto
2013-11-14 11:23:10 -08:00
Jonathan Ong
e51e85e0fc response.etag: remove getter for now
until we figure out a good way to return both weak and strong validators
2013-11-13 21:04:40 -08:00
Jonathan Ong
2f74207e6c response.etag and response.lastModified 2013-11-13 19:59:49 -08:00
Jonathan Ong
0be1442111 expose app-specific prototypes, cleanup/fix tests 2013-11-13 18:41:40 -08:00