url-search-params
Use this module in your EdgeWorker code bundles to assist in query string parsing. The URLSearchParams()
constructor creates and returns a new URLSearchParams object.
import URLSearchParams from 'url-search-params';
export function onClientRequest(request) {
var params = new URLSearchParams(request.query);
if (params.get('key1')) {
request.respondWith(200, {}, '');
} else {
request.respondWith(418, {}, '');
}
}
Updated over 3 years ago