Commit graph

9 commits

Author SHA1 Message Date
Christopher Willis-Ford
64b3b713ba test: mock cross-fetch more completely
Also emphasize that the `Headers` class used in `scratchFetch.js` comes
from `cross-fetch`
2023-03-30 09:09:19 -07:00
Christopher Willis-Ford
f611d043fd refactor: store & merge headers using Headers object
This code will more directly follow Headers rules. In particular:
- Attempting to add metadata with a name that isn't a valid header name
  will cause an error immediately instead of in `applyMetadata` (likely
  at fetch time).
- Header names are not case sensitive. Using a Headers object internally
  means that the metadata API will respect that. For example,
  `setMetadata('a', ...)` will override an earlier value from
  `setMetadata('A', ...)`. Previously, this happened "accidentally" in
  `applyMetadata` instead of in the metadata container itself.
2023-03-28 08:10:07 -07:00
Christopher Willis-Ford
e92be00425 test: expose scratchFetch API better to support testing 2023-03-28 07:54:33 -07:00
Christopher Willis-Ford
4fec39449c fix: send Headers to fetch worker safely
Without this, the Headers object gets corrupted by postMessage and
results in CORS errors complaining about a header field called "map"
2023-03-28 07:52:06 -07:00
Christopher Willis-Ford
8dd89a6a98 feat: allow removing request metadata 2023-03-09 14:23:11 -08:00
Christopher Willis-Ford
9535ff588f fix: don't use ?. in src/ because VM isn't ready for that 2023-03-09 13:39:25 -08:00
Christopher Willis-Ford
9d9bb21e25 fix: apply metadata to FetchWorkerTool too 2023-03-09 13:39:24 -08:00
Christopher Willis-Ford
2a4c4892c4 feat: allow adding metadata to scratchFetch 2023-03-09 13:39:24 -08:00
Christopher Willis-Ford
3283740a04 chore: insert scratchFetch into FetchTool's pipeline 2023-03-09 13:39:24 -08:00