37 Commits
Author SHA1 Message Date
John Hiesey 3bea2a493f Don't turn exceptions thrown in the callback into 'error' events
When using the fetch api, exceptions thrown inside
ClientRequest._onFinish, which also calls the user callback,
were being caught and turned into 'error' events. This is
not the correct behavior; these exceptions should remain
uncaught to let the browser print them to the console.
2015-10-01 22:26:59 -07:00
Matt Crute 031b8aab89 Stop ignoring PATCH request bodies 2015-09-30 11:01:26 -07:00
John Hiesey 2152af414a Remove implementations of ES5 functions not provided in ie8
From now on, IE8 is only supported if polyfills for `Object.keys`,
`Array.prototype.forEach`, and `Array.prototype.indexOf` are
provided. The suggested polyfills from MDN are provided in
ie8-polyfill.js, or you can use https://github.com/es-shims/es5-shim
for a more complete set of polyfills.
2015-09-15 16:54:17 -07:00
John Hiesey 8cab16f26e Change window to global for WebWorker support 2015-09-14 18:18:53 -07:00
John Hiesey 6b9d3d107c Drastically simplify and improve url handling
Make options handling logic match node's `http` module more
closely and let the browser handle all of the relative url
cases itself.

This has a few important advantages:
* Behavior is closer to native `http` modula
* Relative paths in urls are handled properly (fixes #16)
* Code is simpler and more obviously correct
2015-09-11 20:06:13 -07:00
John Hiesey bef2b95708 Fix IPv6 addresses in requests
Fixes #18
2015-09-09 20:25:14 -07:00
John Hiesey a91ed0db64 Modify feature testing to avoid warnings in Chrome
Previously, testing for 'ms-stream' and 'moz-chunked-arraybuffer'
support on the xhr object caused warnings to appear in Chrome.
Since fetch will always be used instead of these when available,
short-circuit and return false when fetch is available.
2015-08-20 01:06:34 -07:00
John Hiesey da4085e33d Make content-type header correct by default
The default behavior now preserves the 'content-type' header, at
the expense of not providing pseudo-streming in Safari, generic
WebKit, and older Chrome. Applications that require streaming
and already use 'prefer-stream' mode will not be affected.

The 'prefer-fast' mode is now deprecated, as that behavior now
matches the default. The 'allow-wrong-content-type' mode is new;
it gives the same behavior as the old default in case binary
streaming is essential.

Fixes #8
2015-08-20 01:01:40 -07:00
John Hiesey 838aaffac7 Fix passing data to request.end()
Previously this would result in an exception.
Thanks @magnuslundstedt for finding the bug!
2015-08-07 17:55:43 -07:00
Cesar Andreu 5fc4858d6d Use same-origin instead of omit with fetch credentials
In order to have parity with XMLHttpRequest fetch credentials should use same-origin instead of omit
Setting XMLHttpRequest.withCredentials to false has no effect on same-site request
2015-07-19 17:06:28 -07:00
John Hiesey 5e81240a05 add process.nextTick for 'close' 2015-07-13 18:14:30 -07:00
John Hiesey 6b544c54a3 Fix spelling of 'destroyed' 2015-07-13 16:45:46 -07:00
John Hiesey 734974d279 Improve behavior of request.prototype.abort() and add destroy synonym 2015-07-13 16:37:04 -07:00
John Hiesey 57ce59c207 Re-add close event on response 2015-07-13 16:07:46 -07:00
John Hiesey 916ab55402 Hide warnings for unsafe headers 2015-07-12 21:25:08 -07:00
John Hiesey 73f1e6f3f0 Stop emitting 'close'
1. This fixes an issue where the `response` module emits an extra
  'end'
2. Node doesn't seem to emit 'close', even if "Connection: close"
  is specified
3. There isn't a real socket, and this module already doesn't
  emit the other socket-related events (and this is documented)
2015-07-12 21:08:00 -07:00
John Hiesey d700e6d8d9 Fix withCredentials flag for fetch implementation 2015-07-12 20:41:20 -07:00
John Hiesey 221ce6d7bd Merge remote-tracking branch 'bendrucker/no-util' 2015-07-12 15:14:09 -07:00
John Hiesey 9d80ac6def Fix unnecessary uses of util 2015-07-12 15:10:37 -07:00
John Hiesey 4eed14a948 Readme improvements 2015-07-07 22:21:01 -07:00
John Hiesey 03aeb58709 Mask high bits out of binary data read as text 2015-07-07 21:13:12 -07:00
John Hiesey cb14102dcd Emit 'socket' for fetch 2015-07-07 20:25:03 -07:00
John Hiesey 333d07b500 Remove extraneous try/catch 2015-07-07 19:25:25 -07:00
John Hiesey 03ba151a6f Test prefer-binary 2015-07-07 19:02:22 -07:00
John Hiesey 89c8220dac Error handling improvements 2015-07-07 18:49:17 -07:00
John Hiesey 4232780821 Add POST tests and fix test failures 2015-07-07 16:35:16 -07:00
John Hiesey 98a3dadbdf Fix basic auth support and add test 2015-07-07 14:35:15 -07:00
John Hiesey 35b1c7a58b Add http-browserify test and reorg tests 2015-07-07 13:40:05 -07:00
John Hiesey 0e1bfedfa1 Rework url logic 2015-07-07 13:15:26 -07:00
John Hiesey 90d812ad44 Lots of fixes plus headers test 2015-07-07 12:52:38 -07:00
Ben Drucker 3f96e0550b Replace util.inherits with inherits module
Also inlines util.isFunction

Reduces bundle size by not including extraneous code
2015-07-03 09:21:06 -04:00
John Hiesey 157b71a58d Add binary streaming test 2015-07-03 02:52:10 -07:00
John Hiesey a29ea0ccab Add text streaming test 2015-07-02 22:01:32 -07:00
John Hiesey 8985094a2b Support binary requests in IE9 2015-07-02 20:00:16 -07:00
John Hiesey db953820d0 Fix arraybuffer mode 2015-07-02 18:18:43 -07:00
John Hiesey ca29b49a8a Use only features supported in ie8 2015-07-02 16:11:33 -07:00
John Hiesey c779668f86 repo cleanup 2015-07-02 14:44:13 -07:00