43 Commits
Author SHA1 Message Date
John Hiesey 8df10e0d65 Avoid passing undefined to xhr.send()
Provides a more elegant fix to #67
2017-01-16 01:57:32 -08:00
Roman Lisagor f97dd885ea Catching fetch read() errors
Errors that occur while reading from the ReadableStream that is returned as part of a `fetch` request were not handled. This change propagates these errors up to the `ClientRequest`.
2017-01-04 14:41:01 -08:00
John Hiesey f9fb1c724c Merge pull request #55 from node-influx/master
Support timeout option in http.request
2016-12-27 13:44:03 -08:00
Xiaoning Liu abdc5573da Add payload for Microsoft Azure Storage MERGE method 2016-11-04 11:35:18 +08:00
Connor Peet 57d0ab245f Support timeout option in http.request 2016-10-17 19:17:44 -07:00
Alex J Burke 53bf1d38e2 Allow using a mode to disable the use of fetch and add a test for the case. 2016-09-01 07:48:38 +01:00
John Hiesey e046049394 Merge pull request #41 from jhiesey/readable-stream
use readable-stream
2016-04-28 00:58:19 -07:00
Feross Aboukhadijeh 0552e1e4f5 use readable-stream
For a consistent version of the stream package.

Also, I believe this will help fix
https://github.com/feross/webtorrent/issues/771
2016-04-28 00:55:58 +02:00
John Hiesey 1d3fca03fa Remove dead line 2016-04-20 01:24:31 -07:00
John Hiesey 6bab67d17a Use to-arraybuffer instead of manual conversion
This fixes some more edge cases when converting from a Buffer to
an ArrayBuffer.

Additionally, compared v2.0.5, this avoids an unnecessary copy
when sending data in a request body.
2016-01-13 03:40:41 +01:00
John Hiesey 6433ea8cad Replace buffer.buffer with more compatible version
Unforunately some browsers use a version of Buffer
that isn't based on a Uint8Array. Add logic to convert
when necessary but not make copies when unnecessary.
2016-01-13 01:33:11 +01:00
Karissa McKelvey 8b9f5a43c1 Use .buffer to comply with buffer@4 and browserify@13 2016-01-12 12:30:39 -08:00
John Hiesey 570f85ec18 Check xhr.status is non-zero to avoid running onXHRProgress on error
Previously, onXHRProgress was being run when readyState was being
set to DONE on error, which was causing exceptions.
2015-10-13 15:46:01 -07:00
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 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 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 916ab55402 Hide warnings for unsafe headers 2015-07-12 21:25:08 -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 4eed14a948 Readme improvements 2015-07-07 22:21:01 -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 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