dojo / core

:rocket: Dojo 2 - language helpers and utilities.
http://dojo.io
Other
213 stars 58 forks source link

Updating request library to mimic fetch API #261

Closed rorticus closed 7 years ago

rorticus commented 7 years ago

This PR updates the request APIs to mimic the fetch APIs, which makes it possible to do cool stuff like look at the response headers before the body is downloaded.

This also introduces an event based Response object that can be used to monitor the download progress and send responses to streams (a helper utility for that will be provided in dojo-streams).

Issue: https://github.com/dojo/core/issues/253

codecov-io commented 7 years ago

Codecov Report

Merging #261 into master will decrease coverage by -1.64%.

@@           Coverage Diff            @@
##           master   #261      +/-   ##
========================================
- Coverage   95.63%    94%   -1.64%     
========================================
  Files          34     37       +3     
  Lines        1900   2167     +267     
  Branches      373    410      +37     
========================================
+ Hits         1817   2037     +220     
- Misses         25     52      +27     
- Partials       58     78      +20
Impacted Files Coverage Δ
src/text.ts 82.75% <100%> (+0.3%) :white_check_mark:
src/has.ts 100% <100%> (ø) :white_check_mark:
src/QueuingEvented.ts 100% <100%> (ø)
src/request/util.ts 66.66% <33.33%> (-22.23%) :x:
src/request/Headers.ts 76.92% <76.92%> (ø)
src/request/Response.ts 81.81% <81.81%> (ø)
src/request/TimeoutError.ts 85.71% <85.71%> (ø)
src/request/providers/xhr.ts 88.27% <88.27%> (ø)
src/request/providers/node.ts 89.1% <89.1%> (ø)
src/request/ProviderRegistry.ts 92.85% <92.85%> (ø)
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a4793c9...724b046. Read the comment docs.

agubler commented 7 years ago

I don't think we have anything dojo 2 using request, so i'm also okay with the changes. See you've asked for a review from @bryanforbes, that's probably a good idea 👍