Commit graph

78 commits

Author SHA1 Message Date
6b27b844ff Add fast parse and remove parseurl 2019-10-11 19:41:53 +00:00
bd05c21456 Fix linter errors 2019-10-11 17:46:53 +00:00
28fee01c3f Remove delegates, dead, is-generator-function, kia-convert and only 2019-10-09 00:32:09 +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
kzhang
23f7f545ab chore: simplify variable () 2019-06-03 16:04:01 +08:00
Vern Brandl
75233d974a chore: Consider removing this return statement; it will be ignored. () 2019-04-17 11:33:36 +08:00
Mikhail Bodrov
d9ef60398e chore: Optimize array split () 2019-01-03 20:48:31 +08:00
Jordan
5560f72912 chore: use the ability of content-type lib directly () 2018-12-07 15:22:12 +08:00
fengmk2
4964242834 fix: use X-Forwarded-Host first on app.proxy present () 2018-10-23 15:20:09 +08:00
Martin Michaelis
9c5c58b183 feat: use :authority header of http2 requests as host ()
close 
2018-10-23 13:21:20 +08:00
Yiyu He
162a5b3e78 perf: lazy init cookies and ip when first time use it () 2018-07-11 11:18:39 +08:00
小菜
74170caf0b chore: fix comment & approve cov () 2018-07-04 11:33:01 +08:00
initial-wu
02feadc4db Lazily initialize request.accept and delegate context.accept () 2018-06-25 16:13:20 +08:00
Ruben Bridgewater
8f047ddb84 fix: use non deprecated custom inspect ()
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
77a4cfb829 Simplify processes in the getter request.protocol () 2018-06-07 22:50:26 +08:00
initial-wu
ef33a79874 chore: mistake in a comment () 2018-06-04 10:18:42 +08:00
Shawn Cheung
8c17517809 use this.response insteadof this.ctx.response () 2018-03-23 17:56:32 +08:00
Martin Iwanowski
327b65cb6b Use node 7+ WHATWG parser for hostname, fixes ()
* Use node 7+ WHATWG parser for hostname, fixes 

* 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 2017-06-20 09:57:07 -07:00
Thiago Lagden
ee5af59f1f replace apply by spread syntax () 2017-04-23 16:14:16 -07:00
Rui Marinho
7ae9c3e109 Fix malformed content-type header causing exception on charset get () 2017-02-13 11:05:35 +08:00
iamchenxin
2db3b1b49a Fix typo for accepts(). ()
it return {String|Array|false}, never return undeifined.
2016-12-07 00:22:11 +08:00
Adam Lau
21c0d823dd fix: subdomains should be [] if the host is an ip ()
Closes: 
2016-09-07 16:21:32 +08:00
PlasmaPower
54e58d3523 req: Cache the request IP 2016-04-03 19:30:06 -07:00
jongleberry
7373c7eca1 comments: remove vague TODOs
closes 
2016-03-12 14:11:19 -08: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
dead_horse
08057e386a ensure parseurl always working as expected 2015-11-04 15:08:49 +08:00
Slobodan Stojanovic
b08facb7bd Fix indentation and add .eslint rules
closes 
2015-10-29 09:55:34 -07:00
jongleberry
16db0f60c4 eslint: add no-var rule 2015-10-22 15:46:47 -07:00
Robert Sköld
e900f0a44a Use shorthand functions
closes 
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 
2015-10-11 16:08:32 -07:00
C.T. Lin
85860587cc implement ctx.origin 2015-09-20 23:49:37 +08:00
AlexeyKhristov
8804b7ba6f add this.req check for querystring() 2015-08-22 14:40:36 -07: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
Douglas Christopher Wilson
9dd99f5da2 Parse Content-Type with "content-type" instead of "media-typer" 2015-02-07 21:24:04 -05:00
Jesús Rodríguez Rodríguez
6c340455f8 Change request's "ips" regex to match others.
So I am in this silly quest of cloning the repo, deleting all the code on it and rewriting it again step by step to pass the tests. It is a acceptable way to learn how koa works.

Anyway, I saw that the regex used in `ips` doesn't match the others on the file, so I thought it would be good to change it.
2015-01-29 17:51:09 +01:00
Rui Marinho
d108926f46 Fix url.format usage of path on node@0.11.15
node@0.11.15 was released with a patch that adds support for `path` to
url.format
(d312b6d15c).

However, this broke `npm install` for git+ssh urls and as such has been
reverted on io.js, making it work like on node@0.11.14 again.

913addbff5
2015-01-23 02:09:21 +00: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
5ca9f451a7 alias request.headers as request.header 2014-08-07 00:04:21 +08:00
dead_horse
fd019688ec use parseurl 2014-07-14 17:57:03 +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
dead_horse
f76268ba58 remove req.host=, fix docs 2014-05-05 12:45:33 +08:00
TJ Holowaychuk
1d9a0e1d31 ocd 2014-05-02 12:21:55 -07:00
Yazhong Liu
b969ecf223 request: complete idempotent methods
see rfc2616: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.1.

Intact idempotent HTTP methods should be:
GET, HEAD, PUT, DELETE, OPTIONS and TRACE
2014-05-03 02:56:08 +08:00
TJ Holowaychuk
4ff54e5c13 ocd 2014-05-01 16:25:08 -07:00