JS Fetch codifica URL

fetch('https://example.com?' + new URLSearchParams({
    foo: 'value',
    bar: 2,
}))
Enthusiastic Eagle