Граф коммитов

572 Коммитов

Автор SHA1 Сообщение Дата
Mislav Marohnić 468f877e44 Firefox now implements `Headers.forEach` natively 2016-11-10 23:32:07 +01:00
Mislav Marohnić 02b1dcb542 Change Headers multiple value handling for spec compatibility
Consider this Headers object:

    var h = new Headers()
    h.append('accept', 'text/html')
    h.append('accept', 'text/plain')
    h.append('content-type', 'application/json')

Before:

- `h.get('accept')` returned `text/html`
- `h.getAll('accept')` returned an array of values
- `h.forEach` (and other iterables) did distinct iterations for each
  value of the same header

Now:

- `h.get('accept')` returns `text/html,text/plain`
- `h.getAll()` is no more
- `h.forEach` (and other iterables) now only do one iteration for each
  headers name, regardless of multiple values

This is in accordance with Section 3.1.2 of the spec, "combine" concept.

The updated tests currently break in Chrome and Firefox when exercising
the native implementation because their implementation is outdated. The
implementation in Edge is more correct, but the tests still fail there
because its implementation combines values with `, ` (notice the space)
rather than `,`.
2016-11-10 23:30:44 +01:00
Mislav Marohnić 9edd55dac0 Assert that a Request can be cloned multiple times 2016-11-10 22:27:10 +01:00
Seph Soliman 9e7cb857bb Avoid consuming body when cloning
Body of Request must be cloned using a value to avoid consumption of
it. Once a new body is initialized, re-initialize the old value.

Fixes #308, closes #335
2016-11-10 22:26:07 +01:00
Mislav Marohnić 57565a1ba1 Rework parsing of raw response HTTP headers
Now splits by `\r\n` because that's the header line delimiter.
No tests because I can't figure out how to return a manually formatted
headers payload from Node.js HTTP server.

Fixes #422
2016-11-10 22:08:26 +01:00
Mislav Marohnić b99a4f22ee Bump url-search-params for IE 11 2016-11-10 21:45:55 +01:00
Mislav Marohnić 94a598ace7 Allow reusing the same GET Request instance multiple times
Fixes #411
2016-11-10 21:40:19 +01:00
Mislav Marohnić 80105aec24 Always construct a new Headers instance in Response
Section 6.4 of the spec:

> If init’s `headers` member is present, run these substeps:
> ... Fill r’s Headers object with init’s `headers` member.

Fixes #416
2016-11-10 21:40:06 +01:00
Mislav Marohnić 43c638af69 Always construct a new Request instance in `fetch()`
Section 6.5 of the spec:

> Let `request` be the associated request of the result of invoking
> the initial value of Request as constructor with `input` and `init`
> as arguments.
2016-11-10 21:40:06 +01:00
Mislav Marohnić ba7ffda7b2 Reorganize tests with the new "fetch method" suite
The Headers, Request, and Response suites should mainly be exercising
those classes and not invoking the `fetch` method. Most of those tests
that do have now been moved to the "fetch method" suite.
2016-11-10 21:40:05 +01:00
Mislav Marohnić 5f61b12416 1st argument to Request constructor must be string or Request
Section 6.3 of the spec:

> If `input` is a string, then run these substeps: ...
> Otherwise (`input` is a Request object), run these substeps: ...

It's worth noting that Chrome and Firefox don't implement this right
now, and will cast any non-Request object passed as 1st argument (even
null/undefined) to a string.
2016-11-10 21:40:05 +01:00
Mislav Marohnić 67627a4782 Merge pull request #427 from mislav/magic-readme-sprinkles
Improve Readme
2016-11-09 19:47:47 +01:00
Mislav Marohnić d294b6ed6e Link to API reference from Readme 2016-11-09 17:31:07 +01:00
Mislav Marohnić 816dec08f6 Add Table of Contents and "Read this first"
Hopefully this will help reduce the number of invalid issues opened.
2016-11-09 15:36:04 +01:00
Mislav Marohnić f5b083d788 Readme tweaks 2016-11-09 15:36:04 +01:00
Mislav Marohnić 11a63b5137 Rework the Installation section
No longer recommend es6-promise due to its size and the fact it doesn't
conform to Promises/A+. Fixes #415
2016-11-09 15:28:02 +01:00
Mislav Marohnić 51c8c58a56 More information about cookies
Fixes #393
2016-11-09 12:51:58 +01:00
Mislav Marohnić 90cf4501c7 Merge pull request #408 from marciopuga/patch-1
Fix grammar
2016-10-14 19:42:00 +02:00
Marcio Puga a85584cb28 Fix grammar
The adjective similar is modifying behave instead of a noun or pronoun. Use an adverb to modify a verb, adjective, or other adverb.
2016-10-14 16:28:17 +01:00
Mislav Marohnić 7ae2487ec4 Merge pull request #403 from samsch/patch-1
Fixed typo in README.md
2016-10-03 18:55:38 +02:00
Samuel Scheiderich 737ecfca21 Fixed typo in README.md
Microsft -> Microsoft
2016-10-03 12:17:35 -04:00
Mislav Marohnić 133f690710 Disable Sauce labs testing in CI
It's been broken for a while, causing everyone's PR to show up as a
failed build. This isn't nice to our contributors, since it's not their
fault.
2016-09-25 14:20:07 +02:00
Mislav Marohnić 14b1ddedbb It looks like Safari 10 didn't ship with native fetch
Fixes #401
2016-09-25 14:15:54 +02:00
David Graham a82b0a9b84 Add Edge and note regarding native fetch support 2016-09-11 08:36:58 -06:00
Mislav Marohnić 9abc1ee0e3 Merge pull request #384 from mruhlin/master
make X-Request-URL header case-insensitive
2016-09-08 22:44:35 +02:00
Mike Ruhlin 65205e460f make X-Request-URL header case-insensitive 2016-08-23 14:33:42 -05:00
Mislav Marohnić 03e2ccc33e Merge pull request #354 from github/sauce-tweaks
Better error handling with Saucelabs
2016-07-25 06:18:05 -09:00
Mislav Marohnić 0d01bce65e Better error handling with Saucelabs
- Timeout handling for sauce_connect
- Have `saucelabs-api` show error message on HTTP errors
- Have `saucelabs-api` exit with nonzero on errors
- Exit with nonzero if Saucelabs reports that 0 tests have ran
- Abort Saucelabs API polling on "test error" (unsure what causes this)
2016-06-17 14:52:43 +02:00
Mislav Marohnić d0132f2a44 Update sauce_connect 2016-06-01 12:47:00 -05:00
Mislav Marohnić 4bde617883 Merge pull request #331 from tarikjn/master
Update Webpack section in README
2016-05-20 21:31:19 +02:00
Tarik Ansari 1920680441 Update Webpack section in README 2016-05-19 10:36:56 -04:00
David Graham ad96feb721 1.0.0 2016-04-28 14:45:13 -06:00
David Graham 6e3aa34e7e Merge pull request #317 from Xuefeng-Zhu/patch-1
refactor Header iterator methods
2016-04-18 18:38:02 -06:00
Xuefeng Zhu 65b611eb0f refactor Header iterator methods 2016-04-18 19:32:11 -05:00
David Graham 7f71c9bdcc Merge pull request #287 from jamonholmgren/patch-1
Add ES2015+ example
2016-04-15 17:24:34 -06:00
Mislav Marohnić b2595455cc Merge pull request #314 from github/update-mocha-phantomjs
Switch to `mocha-phantomjs-core` and system PhantomJS
2016-04-14 21:17:50 +02:00
Mislav Marohnić d1ab5881ac Switch to `mocha-phantomjs-core` and system PhantomJS 2016-04-14 09:03:59 +02:00
David Graham 4dbbfd0e09 Merge pull request #306 from github/timeout-reject
Reject promise on request timeout
2016-04-02 10:44:58 -06:00
David Graham 619ee08d51
Reject promise on request timeout
Firefox and Chrome trigger the request's `onerror` handler when a
timeout occurs. Safari triggers the `ontimeout` handler.

This can be observed by making a request to an unroutable address:

    var xhr = new XMLHttpRequest()
    xhr.onload = console.log.bind(console, 'loaded')
    xhr.onerror = console.log.bind(console, 'errored')
    xhr.ontimeout = console.log.bind(console, 'timeout')
    xhr.open('GET', 'http://10.255.255.1')
    xhr.send()

Fixes #294.
2016-04-01 17:15:48 -06:00
David Graham c23c3f9b3a Merge pull request #272 from jmeas/capitalization
Use uppercase methods in README
2016-03-31 11:13:57 -06:00
David Graham 08fc999a6b Merge pull request #289 from steveluscher/patch-1
Guard against `xhr.getAllResponseHeaders()` being `null`
2016-03-30 14:23:22 -06:00
David Graham cff0ebba8d Merge pull request #304 from github/url-search-params
Add support for URLSearchParams POST body
2016-03-30 13:42:33 -06:00
David Graham 2ead77df94
Replace deprecated npm licenses format 2016-03-30 12:23:59 -06:00
David Graham d77810a15c
Support URLSearchParams POST body
https://fetch.spec.whatwg.org/#body-mixin
2016-03-30 12:22:32 -06:00
David Graham 57b7f98f63 Merge pull request #295 from github/iterators
Add Headers iterators
2016-03-13 10:12:57 -06:00
Steven Luscher 78b3a3bd4d Guard against `xhr.getAllResponseHeaders()` being `null`
From https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#getAllResponseHeaders():

> Returns all the response headers, separated by CRLF, as a string, or null if no response has been received.

I discovered this on Android, once when `xhr.getAllResponseHeaders()` evaluated to `null`.
2016-03-13 00:14:01 +00:00
David Graham a1b7674b69
Make Headers iterable if Symbol is available 2016-03-12 10:47:06 -07:00
David Graham 12e692e7c9
Add Headers#entries iterator 2016-03-12 09:58:02 -07:00
David Graham 6f7a588fd0
Add Headers#values iterator 2016-03-12 09:53:57 -07:00
David Graham 3ebc7ed0b4
Add Headers#keys iterator 2016-03-12 09:48:13 -07:00