Use JSON.stringify on URL to ensure it's properly encoded