Releases: Legitcode/legible
Releases · Legitcode/legible
0.2.11
0.2.10
Block requests by returning false from a url function, heres the use case!
You can globally prevent duplicating requests within the same time period.
let lastUrl;
const onURL = url => {
//block repeat requests within a second of each other
if (url === lastUrl) return false;
lastUrl = url;
setTimeout(() => lastUrl = '', 1000);
return url
};
let response = await partial`
url: ${onURL}
`;
//request was made multiple times in a second, return false!
if(response.requestBlocked) return false
0.2.9
0.2.8
0.2.7
0.2.6
01bda82
Fix bug when merging partial to empty HTTP method
119c307
fix bug merging body
Header callback, allows you to do this:
let response = await partial`
url: https://google.com
headers: ${partial => {
if(partial.options.method === 'POST') return {...headers, 'Content-Type': 'application/json' }
return headers
}}
`