{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular/issues/12638","repository_url":"https://api.github.com/repos/angular/angular","labels_url":"https://api.github.com/repos/angular/angular/issues/12638/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular/issues/12638/comments","events_url":"https://api.github.com/repos/angular/angular/issues/12638/events","html_url":"https://github.com/angular/angular/issues/12638","id":186465087,"number":12638,"title":"[Proposal] new Http APIs with whatwg Fetch spec compatibility","user":{"login":"laco0416","id":1529180,"avatar_url":"https://avatars0.githubusercontent.com/u/1529180?v=3","gravatar_id":"","url":"https://api.github.com/users/laco0416","html_url":"https://github.com/laco0416","followers_url":"https://api.github.com/users/laco0416/followers","following_url":"https://api.github.com/users/laco0416/following{/other_user}","gists_url":"https://api.github.com/users/laco0416/gists{/gist_id}","starred_url":"https://api.github.com/users/laco0416/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laco0416/subscriptions","organizations_url":"https://api.github.com/users/laco0416/orgs","repos_url":"https://api.github.com/users/laco0416/repos","events_url":"https://api.github.com/users/laco0416/events{/privacy}","received_events_url":"https://api.github.com/users/laco0416/received_events","type":"User","site_admin":false},"labels":[{"id":279828207,"url":"https://api.github.com/repos/angular/angular/labels/comp:%20http","name":"comp: http","color":"c7def8","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-11-01T05:58:28Z","updated_at":"2017-03-31T17:44:23Z","closed_at":null,"body":"<!--\r\nIF YOU DON'T FILL OUT THE FOLLOWING INFORMATION WE MIGHT CLOSE YOUR ISSUE WITHOUT INVESTIGATING\r\n-->\r\n\r\n**I'm submitting a ...**  (check one with \"x\")\r\n```\r\n[ ] bug report => search github for a similar issue or PR before submitting\r\n[x] feature request\r\n[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question\r\n```\r\n\r\n## Problem\r\n\r\n`@angular/http`  (hereinafter called \"Angular Http\") was designed as a polyfill for **Fetch API**. For example, a documentation of `Headers` class is the below.\r\n\r\n```\r\n * Polyfill for [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers/Headers), as\r\n * specified in the [Fetch Spec](https://fetch.spec.whatwg.org/#headers-class).\r\n *\r\n * The only known difference between this `Headers` implementation and the spec is the\r\n * lack of an `entries` method.\r\n```\r\n\r\nBut currently, Angular Http is not playing the role of a polyfill of the spec. `Headers`, `Request`, `Response` and other class's type definitions are not compatible with the spec. When major web browsers have the API, Angular users will be confused by the differences. \r\n\r\n**Current behavior**\r\nAngular Http is not a Fetch API polyfill. \r\n\r\n## Proposal\r\n\r\nEven as it doesn't match the spec **now**, of course, I think it should do in the future. All APIs should be aligned to the latest Fetch API spec and they should be transparent as a polyfill. Since its type definitions are maintained as [`@types/whatwg-fetch`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/whatwg-fetch/whatwg-fetch.d.ts) package, Angular Http can use standard `Headers` and more interface types.\r\n\r\n### e.g. `Headers`\r\n\r\n```\r\n// <reference path=\"path/to/node_modules/@types/whatwg-fetch/index.d.ts\" />\r\n\r\nclass NgHeaders implements Headers /** ambient type **/ {\r\n   // ... implementations\r\n}\r\n\r\nexport { NgHeaders as Headers };\r\n```\r\n\r\nAngular Http is protected by semver now. So this proposal focuses on next major version, `@angular/http@3`.\r\n\r\nBTW, who is the caretaker of Http?\r\ncc/ @robwormald "},"comment":{"url":"https://api.github.com/repos/angular/angular/issues/comments/290780196","html_url":"https://github.com/angular/angular/issues/12638#issuecomment-290780196","issue_url":"https://api.github.com/repos/angular/angular/issues/12638","id":290780196,"user":{"login":"jskrzypek","id":1513265,"avatar_url":"https://avatars0.githubusercontent.com/u/1513265?v=3","gravatar_id":"","url":"https://api.github.com/users/jskrzypek","html_url":"https://github.com/jskrzypek","followers_url":"https://api.github.com/users/jskrzypek/followers","following_url":"https://api.github.com/users/jskrzypek/following{/other_user}","gists_url":"https://api.github.com/users/jskrzypek/gists{/gist_id}","starred_url":"https://api.github.com/users/jskrzypek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jskrzypek/subscriptions","organizations_url":"https://api.github.com/users/jskrzypek/orgs","repos_url":"https://api.github.com/users/jskrzypek/repos","events_url":"https://api.github.com/users/jskrzypek/events{/privacy}","received_events_url":"https://api.github.com/users/jskrzypek/received_events","type":"User","site_admin":false},"created_at":"2017-03-31T17:44:22Z","updated_at":"2017-03-31T17:44:22Z","body":"Wouldn't that make it rather cumbersome to use both fetch & xhr within the\nsame app?\n\nOn Fri, Mar 31, 2017, 19:43 Dzmitry Shylovich <notifications@github.com>\nwrote:\n\n> I would prefer to have a single public api with 2 implementations: hxr and\n> fetch. Fetch implementation won't do anything on cancellation and won't\n> generate any progress events, but will parse response async. And users will\n> be able to choose the implementation like HttModule.withHxr() or\n> HttModule.withFetch()\n>\n> —\n> You are receiving this because you were mentioned.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/angular/angular/issues/12638#issuecomment-290765100>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/ABcXMe4PdzW8j00zj8XUdiWNIMstP_spks5rrS1AgaJpZM4Kly7U>\n> .\n>\n"}}
{"actor":{"display_login":"jskrzypek"}}