Commit Graph

63 Commits (master)

Author SHA1 Message Date
Jonatan Nilsson 8fcdbb003c remove more dependencies 2021-01-04 14:06:20 +00:00
Jonatan Nilsson 141d91b216 Add back support for accepts without using npm accepts 2019-10-12 04:30:06 +00:00
Jonatan Nilsson d655f208cb Remove destroy, encoder, error-inject, escape-html, koa-is-json, on-finished, type-is and vary 2019-10-12 00:17:22 +00:00
Jonatan Nilsson 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
fengmk2 4964242834 fix: use X-Forwarded-Host first on app.proxy present (#1263) 2018-10-23 15:20:09 +08:00
Martin Michaelis 9c5c58b183 feat: use :authority header of http2 requests as host (#1262)
close #1174
2018-10-23 13:21:20 +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
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
Ruben Bridgewater 13086d2fcd fix tests: remove unnecessary assert doesNotThrow and api calls (#1170)
* tests: fix error verification

So far the error message was not tested at all. This change makes
sure the error will actually be tested for.

* tests: remove unnecessary api calls

`assert.doesNotThrow` does not provide any benefit since it will
only catch errors and then rethrow in case of an error.
2018-04-09 19:36:52 -07: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
Martin fl0w Iwanowski 012587889d added setters for header and headers, fixes #991 2017-06-20 09:57:07 -07:00
Gilles De Mey d394724200 test: Use Jest (#981) 2017-05-11 11:30:32 +08:00
joehecn 1b3e08e046 test: change a describe to it (#963) 2017-04-20 10:43:06 +08:00
joehecn 19fc4194b7 Test: change a describe to it (#959) 2017-04-16 22:02:32 -06:00
Rui Marinho 7ae9c3e109 Fix malformed content-type header causing exception on charset get (#898) 2017-02-13 11:05:35 +08:00
iamchenxin 2db3b1b49a Fix typo for accepts(). (#863)
it return {String|Array|false}, never return undeifined.
2016-12-07 00:22:11 +08:00
iamchenxin fabf5864c6 Amend typo, request.is() return null|fasle|string. (#864)
Modifying the test for `null` from `==` to `===` to make sure it must be `null`.
2016-12-01 18:16:02 +08:00
Adam Lau 21c0d823dd fix: subdomains should be [] if the host is an ip (#808)
Closes: #775
2016-09-07 16:21:32 +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
PlasmaPower 54e58d3523 req: Cache the request IP 2016-04-03 19:30:06 -07:00
dead_horse 08057e386a ensure parseurl always working as expected 2015-11-04 15:08:49 +08: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
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
Slobodan Stojanovic cc1d41f5e3 Refactor tests - add arrow functions
Refactor tests - move .should to the same line as arrow function
2015-10-25 13:26:36 -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
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 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
Tejas Manohar 5e21238594 add newline to bottom of file where missing 2015-10-05 18:19:32 -05:00
TJ Holowaychuk 1ed691dde3 fix some test formatting 2015-10-02 18:49:20 -07:00
Bryan Bess 0192d21d73 Increase test coverage 2015-10-02 19:18:05 -05:00
Bryan Bess 890244fc74 Fix typo 2015-09-26 09:23:17 -05:00
C.T. Lin 85860587cc implement ctx.origin 2015-09-20 23:49:37 +08:00
Aaron Heckmann 6392ee0407 return same object from request.query
Before this change, calling request.query when there was no querystring
resulted in a new object created and returned each time. If the resulting
object was ever changed, accessing request.query would not reflect it and
cause weird bugs.
2015-05-21 12:55:58 -07:00
dead_horse c8eb5eefb1 make sure helpers return strict string 2015-04-29 01:44:02 +08:00
fengmk2 dd3a0fcdfa make sure req.host and req.hostname return strict string
Should return empty string when no host present.
2015-03-30 17:44:32 +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 eff4886cd8 ocd 2014-11-16 21:52:14 +08:00
dead_horse 5ca9f451a7 alias request.headers as request.header 2014-08-07 00:04:21 +08:00
dead_horse 5b18f8bab0 parse req.type by media-typer 2014-07-09 23:52:56 +08:00
dead_horse e791100993 add more test case, fix req.idempotent 2014-07-06 16:52:02 +08: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
Jonathan Ong 11cf47c8a6 remove .request accept tests the fail
due to
https://github.com/expressjs/accepts/commit/5975ce464575bd0fddfdd3d41796
958cd6bfc20b. passing nothing into accepts() is silly anyways.
2014-06-03 21:35:11 -07:00
dead_horse f76268ba58 remove req.host=, fix docs 2014-05-05 12:45:33 +08:00
dead_horse 72a9b69146 add request.hostname(getter), fixed #224
make request.host and request.hostname work as node url lib
http://nodejs.org/api/url.html#url_url
this commit will change older request.host(getter)
2014-02-26 14:03:05 +08:00
TJ Holowaychuk 785aba879c add request.charset 2014-02-14 09:38:59 -08:00