tgvashworth / fetch-engine

A smart request-making library
24 stars 6 forks source link

Implement fetch #15

Closed tgvashworth closed 8 years ago

tgvashworth commented 8 years ago

Request and Response should be come first, as per #13.

Implement & test fetch from the fetch spec.

Probably a new file in src called fetch.ts with a matching fetch.test.ts file. It should implement the Fetch type from /src/.d.ts:

export function fetch(request: string, init?: RequestInit): Promise<Response> {
  // ...
};

For now, this only need to run in the browser (don't worry about node).

We should file another issue about running these test across many browsers.

tgvashworth commented 8 years ago

For this we actually need two functions: an input normaliser (RequestInfo input, optional RequestInit init) => Request, and a fetch method that only accepts a Request.

tgvashworth commented 8 years ago

This should be as simple as passing the arguments into a Request constructor at the start of the fetchEngine inner function, but currently this doesn't work. See #48.

tgvashworth commented 8 years ago

Have added isomorphic-fetch as a dependency for the time being, so fetch-engine works. If we need to improve this in future, we can reopen.