486a557d75
* Recsys/FYP: add documentation. * Recsys: capture and use `x-uuid` from search results Ticket: 1717
10 lines
368 B
JavaScript
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));
|
|
}
|