lbry-desktop/ui/util/handle-fetch.js
infinite-persistence 486a557d75
Recsys: capture and use x-uuid from search results (#1727)
* Recsys/FYP: add documentation.

* Recsys: capture and use `x-uuid` from search results

Ticket: 1717
2022-06-22 09:43:54 -04:00

10 lines
368 B
JavaScript

// @flow
export default function handleFetchResponse(response: Response): Promise<any> {
const headers = response.headers;
const poweredBy = headers.get('x-powered-by');
const uuid = headers.get('x-uuid');
return response.status === 200
? response.json().then((body) => ({ body, poweredBy, uuid }))
: Promise.reject(new Error(response.statusText));
}