Re: [whatwg/fetch] Why doesn't `fetch` reject if 400 ≤ status < 600? (#18)

```
// Typescript
export const fetcher = async <T = any>(
  input: RequestInfo,
  init?: RequestInit
): Promise => {
  const response = await fetch(input, init);
  if (!response.ok) throw new Error(response.statusText);
  return response.json();
};

// Javscript
export const fetcher = async(input, init = {}) => {
  const response = await fetch(input, init);
  if (!response.ok) throw new Error(response.statusText);
  return response.json();
};
```


-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/18#issuecomment-1200072028
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/issues/18/1200072028@github.com>

Received on Saturday, 30 July 2022 02:44:30 UTC