Commit graph

122 commits

Author SHA1 Message Date
141d91b216 Add back support for accepts without using npm accepts 2019-10-12 04:30:06 +00:00
bd05c21456 Fix linter errors 2019-10-11 17:46:53 +00:00
fad4d10057 Remove http-assert and replace it with just a simple function :) 2019-10-11 16:57:01 +00:00
dd35564df4 Remove statuses and replace http-errors with http-errors-lite 2019-10-11 16:40:06 +00:00
28fee01c3f Remove delegates, dead, is-generator-function, kia-convert and only 2019-10-09 00:32:09 +00:00
c9459b19ba Remove cookies, replace debug with debug-ms 2019-10-08 18:44:33 +00:00
2ef7846b5f Remove accepts, cache-content-type and content-type.
Replace content-disposition with one that doesn’t use safe-buffer
2019-09-29 19:17:14 +00:00
Martin Iwanowski
71aaa29591 docs: fix spelling in throw docs (#1269) 2018-11-05 17:16:27 +08:00
Jordan
bc81ca9414 chore: use res instead of this.res (#1271) 2018-11-05 17:15:58 +08:00
Waleed Ashraf
88b92b4315 doc: updated docs for throw() to pass status as first param. (#1268) 2018-11-01 19:17:16 +08:00
Yiyu He
162a5b3e78 perf: lazy init cookies and ip when first time use it (#1216) 2018-07-11 11:18:39 +08:00
小菜
2cdbc52e38 test&cov: add test case (#1211) 2018-07-01 01:29:19 +08:00
initial-wu
02feadc4db Lazily initialize request.accept and delegate context.accept (#1209) 2018-06-25 16:13:20 +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
Alexsey
6baa41178d Error handling: on non-error throw try to stringify if error is an object (#1113) 2017-12-24 20:48:44 +08:00
Luke Bousfield
67630217ae Fix context.inspect when called on the prototype (#1012)
* Fix context.inspect when called on the prototype

Fixes #837

* Add tests
2017-07-15 20:05:26 -04:00
Martin Iwanowski
327b65cb6b Use node 7+ WHATWG parser for hostname, fixes #1002 (#1004)
* Use node 7+ WHATWG parser for hostname, fixes #1002

* only use URL if host is IPv6, expose parsed URL

* catch invalid URLs, memoize empty obj

* hostname returns empty string when URL throws
2017-06-20 09:57:30 -07:00
Thiago Lagden
ee5af59f1f replace apply by spread syntax (#971) 2017-04-23 16:14:16 -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
fengmk2
e452b68bd9 feat: set err.headerSent before app error event emit (#919) 2017-02-28 10:52:54 +08:00
Lee Bousfield
a440425dc2 Add support for headers in errors 2016-03-12 17:46:35 -07:00
Lee Bousfield
6a147726bd Add support for flushing headers 2016-03-03 21:01:56 -07:00
Michaël Zasso
a157937969 lib: fix style issues 2015-10-13 09:23:57 +02: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
C.T. Lin
85860587cc implement ctx.origin 2015-09-20 23:49:37 +08:00
dead_horse
b6aea969f8 non-error thrown, fixed #432 2015-04-14 10:34:55 +08:00
dead_horse
5a3f32dfdd Add res.append(field, val) to append headers 2015-01-26 02:20:08 +08:00
fengmk2
3e66157472 ctx.request.href: get full request url, include protocol, host and originalUrl
Useful on those scenes need current full request url, like `OAuth`.
2014-12-27 14:17:00 -08:00
dead_horse
efdd7d3716 less strict for status, close #350
add res.message[=]
2014-10-09 23:20:53 +08:00
Jonathan Ong
2f0fe55ae3 .throw() -> http-errors, .assert() -> http-assert 2014-09-20 10:46:28 -07:00
Ian Storm Taylor
5931714bd8 make the second argument to throw properly optional 2014-08-12 13:19:14 -07:00
dead_horse
f6626967b2 ignore props.status in ctx.throw 2014-08-09 13:38:54 +08:00
Ian Storm Taylor
bcac468f7c add the ability to pass props to context.throw 2014-08-08 12:37:04 -07:00
TJ Holowaychuk
f9eb219ecf Merge pull request #330 from dead-horse/onerror-status
Onerror status
2014-08-07 19:04:10 -07:00
dead_horse
fa5948cca3 do not expose when err.status not valid 2014-08-08 10:02:24 +08:00
dead_horse
5ca9f451a7 alias request.headers as request.header 2014-08-07 00:04:21 +08:00
dead_horse
e2f61595b8 fix err.status invalid lead to uncaughtException 2014-08-06 21:32:35 +08:00
Jonathan Ong
1605f33760 add context.inspect(), cleanup app.inspect()
closes #323 closes #250
2014-08-02 18:24:53 -07:00
Jonathan Ong
690604b6d2 remove this.error()
it’s been deprecated for long enough
2014-07-06 02:36:12 -07:00
Jonathan Ong
4a6b49cd30 delegate: remove this.append() 2014-06-07 03:48:03 -07: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
Jonathan Ong
01dd6a33c5 context: delegate etag/last-modified 2014-06-05 16:19:29 -07:00
dead_horse
4979077562 assert non-error obj pass to app.onerror, fixed #287 2014-06-04 14:16:25 +08:00
dead_horse
f76268ba58 remove req.host=, fix docs 2014-05-05 12:45:33 +08:00
TJ Holowaychuk
4ff54e5c13 ocd 2014-05-01 16:25:08 -07:00
TJ Holowaychuk
94dd87741e ocd 2014-04-24 17:58:37 -07:00
dead_horse
6a2ed3e6eb assert object type in ctx.onerror 2014-04-25 08:34:11 +08:00