Timothy Gu
e9db869523
Remove FOLLOW_SPEC option; make it the default behavior ( #225 )
...
* Remove !FOLLOW_SPEC mode
* Update UPGRADE-GUIDE
* Add CHANGELOG entry
2017-01-23 07:54:28 -08:00
Timothy Gu
502b604208
Fix Headers iterable initializer handling
2017-01-14 21:22:23 -08:00
Timothy Gu
f198f93767
test: remove fallbacks for Node.js 0.10
2017-01-14 20:56:26 -08:00
Timothy Gu
151de2bdfb
Use ES2015 export syntax ( #212 )
...
* Implement Rollup's external module check
* Use ES2015 export syntax
More friendly to ES2015 environments.
2017-01-14 20:50:10 -08:00
Nathan Rajlich
fa22529128
proper stack first line for FetchError instances ( #215 )
...
The `.stack` property gets cached in the `captureStackTrace()` call, so
whatever is set as the `name` and `message` at that time will be used
for the first line of the stack trace.
Before this patch, FetchError's stack would just say "Error" as the
first line. Now they correctly display the "${name}: ${message}" of the
error instances.
Test case included.
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
2016-12-14 15:41:35 -08:00
Timothy Gu
0f7e6c15d3
Back to 100%
2016-12-05 21:20:00 -08:00
Timothy Gu
90d3bc4436
Set content-length for buffer bodies
2016-12-05 20:30:00 -08:00
Timothy Gu
a604069860
More exact content-type and content-length
...
Set content-type of requests with body being objects to text/plain
2016-12-05 20:27:08 -08:00
Timothy Gu
385ca6b2b0
To 100% branches coverage
2016-12-05 19:48:59 -08:00
Timothy Gu
4d944365df
Fix tests added in the last commit
2016-12-05 15:21:19 -08:00
Timothy Gu
e7a13a5314
Add support for blobs
2016-12-05 15:06:22 -08:00
Timothy Gu
cc4ace1778
Make body default to null in Request
...
Fixes #208 .
2016-12-04 13:16:03 -08:00
Timothy Gu
3d676235a8
Throw when a GET/HEAD Request is created with body
...
As mandated by the spec
2016-12-04 13:15:03 -08:00
Timothy Gu
d3071fa46a
Revert "Return empty .json() object on 204. Fix #165 . ( #166 )" ( #201 )
...
This reverts commit 95b58936b8
.
Fixes #165 .
2016-11-26 09:07:12 -08:00
Timothy Gu
25ff99677d
Improve Headers' iteration support
...
Class strings, spec-compliant forEach, etc.
2016-11-23 15:06:30 -08:00
Timothy Gu
a355664e64
Update packages
2016-11-23 11:30:01 -08:00
Timothy Gu
5fe80dba06
Remove dependency on babel-polyfill
...
This way the tests can better emulate the real Node.js environment.
2016-11-05 10:26:30 -07:00
Timothy Gu
72d34af6e2
Start test server when executed directly
2016-11-05 09:39:01 -07:00
Timothy Gu
76cb57cace
Support WHATWG URL objects
...
Fixes #175 .
2016-10-15 10:19:52 -07:00
Timothy Gu
b092a8ed12
Add test for constructing Request with parsed URL object
2016-10-15 10:19:52 -07:00
Timothy Gu
d3b4161d7c
Add a new res.textConverted() and always use UTF-8 for res.text()
...
Also uses iconv-lite directly instead of using the "encoding" package.
Fixes #184 .
2016-10-15 09:41:52 -07:00
Timothy Gu
2a7ef63bc4
Add FOLLOW_SPEC mode
2016-10-15 08:21:51 -07:00
Timothy Gu
2cafdcb5e4
Validate headers
2016-10-15 08:21:51 -07:00
Timothy Gu
fba873d3fe
Make sure to coerce header values to string
2016-10-15 08:21:51 -07:00
Timothy Gu
82c1e78184
Allow constructing Headers with an Array
2016-10-15 08:21:51 -07:00
Timothy Gu
67326e3873
Condense class toString tests
2016-10-12 20:51:19 -07:00
Timothy Gu
4d81cb4877
Test @@toStringTag getter of all classes
2016-10-12 17:29:33 -07:00
Timothy Gu
0f65af3fd8
Split Headers iterable test into four
2016-10-12 17:29:33 -07:00
Timothy Gu
c3a121a360
Add support for Body#arrayBuffer
2016-10-12 17:29:33 -07:00
Timothy Gu
64e239b092
Improve Body spec compliance when body is null
2016-10-12 17:29:33 -07:00
Timothy Gu
a0be6aa34a
Simplify Request constructor
...
Also make Request more standard compliant:
> The `url` attribute's getter must return request's url, **serialized.**
2016-10-12 17:29:33 -07:00
Timothy Gu
838071247d
Convert all files to ES2015 ( #182 )
...
Elements of this commit come from #140 by @gwicke.
2016-10-10 11:50:04 -07:00
Timothy Gu
993d4cdea1
Convert Headers to ES2015 and implement Iterable interface ( #180 )
...
Closes #127 , #174 .
2016-10-08 20:51:01 -07:00
Timothy Gu
7c26fa9479
Add Babel infrastructure
...
No actual code has been changed yet.
2016-10-04 02:59:46 -07:00
David Frank
e926483448
minor format fix and comments
2016-09-24 17:12:18 +08:00
Dan Dascalescu
95b58936b8
Return empty .json() object on 204. Fix #165 . ( #166 )
...
Handle an edge case where 204 No Content response body is empty, but node-fetch trying to parse the empty body as-is.
2016-09-24 17:06:18 +08:00
David Frank
ffddec0ad2
fix test: buffer.alloc is not available for older node.js release
2016-09-11 23:34:50 +08:00
David Frank
788c4627a7
make sure we default to 200 on new response
2016-09-11 23:17:09 +08:00
David Frank
f17aa9af1f
call tostring on plain object body
2016-09-11 22:33:22 +08:00
David Frank
e4a7da8326
making sure headers will drop buffer value
2016-09-11 22:18:43 +08:00
David Frank
6bac50f1da
fix bug related to request wrapping, where counter adopts follow value incorrectly
2016-09-11 22:02:39 +08:00
David Frank
d24ec6f7c4
handle raw deflate response from old servers
2016-08-03 17:31:46 +08:00
David Frank
49363411f8
add a much-requested buffer() method for convenience
2016-08-03 13:27:32 +08:00
David Frank
140ae57f77
support buffer for request body
2016-08-03 13:07:47 +08:00
David Frank
3c05442699
HEAD request does not need to process body with decompression
2016-08-03 12:55:58 +08:00
David Frank
2a6e656c1d
allow any url for new request, but still reject non-http url in fetch
2016-05-26 02:19:16 +08:00
David Frank
a2607719ce
send delete body with content-length
2016-05-26 02:00:25 +08:00
David Frank
8a6213198b
avoid calling formdata getLengthSync when it has stream as fields
2016-05-26 01:37:36 +08:00
David Frank
419597fe13
user should be able to resolve cloned body before original body
2016-05-26 01:01:56 +08:00
David Frank
8b8309fe0f
handle gzip encoding with 204 and 304 responses
2016-05-26 00:46:11 +08:00
David Frank
7f68577de4
let nodejs handle the connection pool when agent is passed
2016-04-30 13:19:08 +08:00
David Frank
311a8d5951
fix manual redirect mode
2016-04-13 02:58:04 +08:00
David Frank
64d798dd83
add basic support for redirect mode
2016-04-06 02:47:23 +08:00
David Frank
2ebaee639f
use a IETF reserved domain name for invalid dns test
2016-04-06 02:01:07 +08:00
David Frank
d28febd497
check that FetchError is an instanceof Error
2016-04-06 01:54:20 +08:00
David Frank
ea8d7ca15f
socket timeout should really be custom request timeout, change name to reflect it
2016-04-06 01:47:07 +08:00
Christian Pekeler
b6f3913499
Support for program checkable error by introducing custom errors with error types/codes
...
This finally closes #7
2016-04-05 21:20:42 +08:00
David Frank
4d63427123
demostrate restream more clearly in tests
2016-03-23 15:23:56 +08:00
David Frank
89ce1b70b6
fix formdata support when you are trying to wrap the request
2016-03-23 15:02:04 +08:00
David Frank
4b589bc147
node v0.10 allow header support is weird, attempt to fix test
2016-03-19 18:52:13 +08:00
David Frank
827ce8fa31
fix tests for older node
2016-03-19 18:36:53 +08:00
David Frank
9a90e7d0b9
test for options support
2016-03-19 18:24:08 +08:00
David Frank
362aa087ca
clone method support
2016-03-19 18:06:33 +08:00
David Frank
00fa867914
fix chunked encoding support for character encoding conversion, thx @dsuket PR #50
2016-03-19 16:17:14 +08:00
David Frank
85c18162ac
test for form-data content-length hack
2016-03-19 15:51:48 +08:00
David Frank
c3a4e96a61
more test cleanup
2016-03-19 15:33:13 +08:00
David Frank
4624f41385
fix coverage and remove duplicate tests
2016-03-19 15:11:16 +08:00
David Frank
79d2e2cc37
bump dependencies and fix incompatible tests
2016-03-19 14:41:19 +08:00
Kirill Konshin
e658483ebe
Fix for #38 and #36
...
Support string/buffer bodies in Response constructor
Request should have Body methods like text(), json()
2016-02-17 10:50:55 -08:00
Tomáš Ehrlich
751cf6cd29
Add Headers.forEach method.
2015-10-27 06:13:02 +01:00
David Frank
cf128ddfb8
make sure we test with transform stream
2015-09-28 23:04:14 +08:00
David Frank
6072402eb6
test case for Response ctor
2015-09-28 22:39:53 +08:00
David Frank
b48757013a
per spec, follow redirect with GET request
2015-09-28 22:30:41 +08:00
David Frank
8f02a2b77c
handle body stream error
2015-09-28 21:58:45 +08:00
David Frank
cfe98cdd35
make sure we don't overwrite existing content-length
2015-09-28 19:27:57 +08:00
David Frank
c22bfa8189
auto add content-length on for string body
2015-09-28 17:40:58 +08:00
Kirill Konshin
765aef29f8
Fix for #33
...
Added parsing of Headers in Response & Request constructors
2015-08-08 19:43:55 -07:00
David Frank
565ec4b35a
additional tests for the new form-data integration
2015-07-22 15:40:52 +08:00
Dylan Piercey
ffac4177b0
Automatically pull headers from node-form-data.
2015-07-22 02:05:06 +00:00
David Frank
b64073c64c
update comment to explain hack, make use of inpsect route in test, and update changelog
2015-07-11 19:38:26 +08:00
Matthew Andrews
e98f22b3ba
Add failing test for the ability to set a custom header
2015-07-11 10:37:51 +01:00
David Frank
feb4808a22
allow request wrapping
2015-06-04 12:40:01 +08:00
David Frank
9b5330dfe3
add basic test case for request
2015-06-04 12:12:27 +08:00
David Frank
a322795339
handle common mistake of passing number as header
2015-05-04 12:05:06 +08:00
Rhys Evans
5e4d9b1a60
expose response and headers constructors
2015-05-03 09:43:59 +01:00
David Frank
596232fd90
better test for headers, only support string and array
2015-04-29 12:15:08 +08:00
David Frank
19dcea47f1
add Headers support
2015-04-22 23:36:11 +08:00
David Frank
e09dfae0a5
timeout on body and clear timeout internally
2015-04-17 13:26:55 +08:00
Kirill Dmitrenko
d868add4db
Test for clearing timeout
2015-04-16 21:46:22 +03:00
David Frank
3f59e6e964
added test cases for regex
2015-03-24 12:31:04 +08:00
David Frank
a8bb5650ad
fix follow=0 scenario
2015-03-20 00:22:23 +08:00
David Frank
281037c795
travis and tests update, plus some doc clean up
2015-03-19 23:38:27 +08:00
David Frank
48a0a9a2f2
xml encoding detection, response size limit
2015-01-28 22:56:25 +08:00
David Frank
9358045798
redirect 301 result in status 200 and res.ok true
2015-01-28 13:10:33 +08:00
David Frank
60d232d66a
better test coverage on edge case
2015-01-28 13:01:10 +08:00
David Frank
be778b9d8c
better tests and doc for res.ok
2015-01-28 12:17:12 +08:00
Matthew Andrews
ff5eabfdf4
Add a convenience `ok` getter on `Response`
2015-01-27 23:43:06 +00:00
David Frank
ff81206c4a
better test coverage
2015-01-28 01:00:53 +08:00
David Frank
53a763beab
more tests
2015-01-27 23:33:06 +08:00
David Frank
af21ae6c1c
basic refactor done
2015-01-27 21:11:26 +08:00
David Frank
93a983d815
basic fetch feature done
2015-01-27 01:46:32 +08:00
David Frank
f57ebe10df
basic streaming body
2015-01-26 21:58:52 +08:00
David Frank
78853fc544
add test cases
2015-01-26 21:28:23 +08:00
David Frank
75699bb467
basic http added
2015-01-26 18:15:07 +08:00
David Frank
9c472a52f2
setup repo
2015-01-26 17:02:34 +08:00