1. 05 5月, 2016 4 次提交
  2. 19 1月, 2016 4 次提交
  3. 18 1月, 2016 5 次提交
  4. 13 1月, 2016 7 次提交
  5. 11 1月, 2016 1 次提交
  6. 10 1月, 2016 2 次提交
  7. 09 1月, 2016 1 次提交
    • E
      Make fetch add a `Content-Type` header based on the type of the body. · 1e4a6151
      Emily Eisenberg 提交于
      Summary: The process of extracting a body from a passed in body object
      (described here: https://fetch.spec.whatwg.org/#concept-bodyinit-extract)
      creates both a byte stream and a corresponding `Content-Type` value. These two
      values are used in the constructor of `Request` and `Response` objects to
      initialize the body and to set an initial `Content-Type` header.
      
      This change makes `Body._initBody()` return the `Content-Type` value
      corresponding to the type of the object passed in, and to set that header in
      the corresponding `Request` and `Response` objects that are being constructed.
      
      There's a little bit of a dance I need to do in Request to keep track of where
      the body is coming from, because we're only supposed to be setting the
      `Content-Type` header if we're getting the body from the options passed in, not
      if we're copying it from another `Request`. See step 32 of
      https://fetch.spec.whatwg.org/#dom-request. (This was caught by one of the
      tests. Yay tests!)
      
      I added some corresponding tests to make sure this works.
      
      Test Plan:
      I'm a little bit confused about how to run the tests normally, but this is what
      I did:
      
       - Run `make lint`, see that everything passes
       - Start up the test server by running `node script/server 3900 &`
       - Visit http://localhost:3900/test/test.html and
         http://localhost:3900/test/test-worker.html in Chrome and see that all of
         the tests pass.
      
      From what I can tell, running the tests in Chrome just used the native fetch
      objects, so to test the polyfill I added `window.fetch = null` in
      test/test.html before it includes '../fetch.js', and added `self.fetch = null`
      in test/worker.js before it imports '../fetch.js'. Then:
      
       - Visit http://localhost:3900/test/test.html and
         http://localhost:3900/test/test-worker.html in Chrome and see that all of
         the tests pass.
      
      Reviewers: @jeresig
      1e4a6151
  8. 03 11月, 2015 3 次提交
  9. 01 11月, 2015 1 次提交
  10. 31 10月, 2015 1 次提交
  11. 12 10月, 2015 11 次提交