Commit graph

49 commits

Author SHA1 Message Date
Adam Lau
b1a14f1a73 fix: subdomains should be [] if the host is an ip (#807)
* fix: subdomains should be [] if the host is an ip

Fixes #775
2016-09-07 11:23:39 +08:00
jongleberry
572b4599f0 comments: remove vague TODOs
closes #576
2016-03-01 15:01:35 -08:00
dead_horse
c243baa4d1 ensure parseurl always working as expected 2015-11-05 10:55:28 +08: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
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
dead_horse
5de9d962a0 remove unused debug 2014-04-25 00:07:37 +08:00
Dmitry Mazuro
9e8d6a3aa0 ocd 2014-03-24 21:21:15 +03:00
TJ Holowaychuk
9b1651a8e6 fix inspection of app. Closes #108 2014-03-11 11:06:57 -07:00
TJ Holowaychuk
c50012a636 Merge pull request #225 from dead-horse/issue224-host-confused
add request.hostname(getter), fixed #224
2014-02-26 10:54:40 -08:00
Robert Sköld
e77e5a4bdc Debug name koa:context -> koa:request 2014-02-26 09:51:45 +01: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
pana
30d200dc09 remove the vary method from request object 2014-01-17 18:19:51 +08:00
jeromew
93351bf845 Add req.host= 2014-01-07 21:09:01 +00:00
Jonathan Ong
e71937491b refactor: remove unused argument 2013-12-29 22:33:59 -08:00
Jonathan Ong
20615b808d refactor: move .is to type-is 2013-12-27 18:56:09 -08:00
Jonathan Ong
7fe4133b4a refactor: move content negotiation to accepts 2013-12-27 18:56:02 -08:00
Jonathan Ong
0c330ffb1a lint: remove unused references, fix global leak 2013-12-09 01:53:18 -08:00
TJ Holowaychuk
a2582e7aa3 change req.is() to return the canonical mime type 2013-11-28 12:47:23 -08:00
TJ Holowaychuk
5dfadba96f remove null return from .is() 2013-11-28 12:39:45 -08:00
TJ Holowaychuk
48601ea7d8 add matchesMime() util 2013-11-28 12:38:35 -08:00
TJ Holowaychuk
271d921c41 change an .is() example
text/* already covers it
2013-11-28 12:29:28 -08:00
Jonathan Ong
8717a3ad2b req.is(): make better
closes #105 and #106
2013-11-28 00:13:16 -08:00
Jonathan Ong
e447e731b6 req.acceptsLanguage - default to first type fi header not set 2013-11-26 14:52:24 -08:00
Jonathan Ong
c24ab00b23 req.acceptsCharsets - default to first type if header not set 2013-11-26 14:49:07 -08:00
TJ Holowaychuk
8e10f12d38 add ctx.remove() and res.remove(). Closes #100 2013-11-24 05:06:35 -08:00
Jonathan Ong
1d38d4acd1 req.accepts: default to first 'type' 2013-11-20 18:00:24 -08:00
Jonathan Ong
5ae3f4eb30 req.acceptsEncodings: default to 'identity' 2013-11-20 17:46:11 -08:00
Jonathan Ong
28ca80758b ctx.search and ctx.request.search 2013-11-18 19:29:29 -08:00
TJ Holowaychuk
35a0c1d2bb add {request,response,context}#toJSON() 2013-11-14 11:30:56 -08:00
Jonathan Ong
0be1442111 expose app-specific prototypes, cleanup/fix tests 2013-11-13 18:41:40 -08:00
TJ Holowaychuk
93f1bce66f fix ctx.ip
need tests for this
2013-11-13 13:17:16 -08:00
TJ Holowaychuk
c699c75c52 add koa Request / Response objects and delegation. Closes #52 2013-11-13 09:01:15 -08:00