{"action":"closed","issue":{"url":"https://api.github.com/repos/slightlyoff/ServiceWorker/issues/279","labels_url":"https://api.github.com/repos/slightlyoff/ServiceWorker/issues/279/labels{/name}","comments_url":"https://api.github.com/repos/slightlyoff/ServiceWorker/issues/279/comments","events_url":"https://api.github.com/repos/slightlyoff/ServiceWorker/issues/279/events","html_url":"https://github.com/slightlyoff/ServiceWorker/issues/279","id":33668601,"number":279,"title":"\"I want to make an image request\"","user":{"login":"jakearchibald","id":93594,"avatar_url":"https://avatars.githubusercontent.com/u/93594?v=3","gravatar_id":"","url":"https://api.github.com/users/jakearchibald","html_url":"https://github.com/jakearchibald","followers_url":"https://api.github.com/users/jakearchibald/followers","following_url":"https://api.github.com/users/jakearchibald/following{/other_user}","gists_url":"https://api.github.com/users/jakearchibald/gists{/gist_id}","starred_url":"https://api.github.com/users/jakearchibald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakearchibald/subscriptions","organizations_url":"https://api.github.com/users/jakearchibald/orgs","repos_url":"https://api.github.com/users/jakearchibald/repos","events_url":"https://api.github.com/users/jakearchibald/events{/privacy}","received_events_url":"https://api.github.com/users/jakearchibald/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/slightlyoff/ServiceWorker/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/slightlyoff/ServiceWorker/labels/fetch","name":"fetch","color":"bfd4f2"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2014-05-16T11:54:28Z","updated_at":"2015-04-13T10:19:05Z","closed_at":"2015-04-13T10:19:05Z","body":"Browsers make requests differently depending on their context.\r\n\r\nhttp://jsbin.com/yacar/1/quiet - here I'm request the same url, one using XHR and one using `<img>`. The browser cannot dedupe these as they have separate `Accept` headers.\r\n\r\nWhen using `fetch()` and populating caches, it'd be useful to ask the browser to make the request as if it were for an \"image\" or a \"font\". These are terms we currently use for `fetchEvent.context`.\r\n\r\nI propose we move `.context` onto `Request` objects, and allow it to be set in constructor. The initial value of \"context\" will affect headers in a way that's UA-specific (eg, Chrome Accepts image/webp, Firefox does not). Any user-set headers will take priority.\r\n\r\n```js\r\nvar req = new Request({\r\n  url: '/whatever.png',\r\n  context: \"image\"\r\n});\r\n\r\nreq.headers.get('Accept') == \"image/webp,*/*;q=0.8\"; // in Chrome\r\n```"}}