Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const textOk = (body) => {
const mockResponse = new Response(body, {
status: 200,
headers: {
'Content-type': 'text/html; utf-8'
}
});
return Promise.resolve(mockResponse);
};
const jsonError = (status, statusText) => {
const mockResponse = new Response('', {
status: status,
statusText: statusText,
headers: {
'Content-type': 'application/json',
},
});
return Promise.resolve(mockResponse);
};
const jsonOk = (body) => {
const mockResponse = new Response(JSON.stringify(body), {
status: 200,
headers: {
'Content-type': 'application/json'
}
});
return Promise.resolve(mockResponse);
};
const jsonOk = (body) => {
const mockResponse = new Response(JSON.stringify(body), {
status: 200,
headers: {
'Content-type': 'application/json; utf-8'
}
});
return Promise.resolve(mockResponse);
};