URL Encode Key values (#302)
URL Encode Key values (#302)

* URL Encode Key values

Currently, the path is used for submitting data that may contain special characters. For example, if you try to set up bulk redirects in Workers with KV per https://developers.cloudflare.com/workers/recipes/bulk-redirects/, the key '/pathtoreplace' is stored in KV as 'pathtoreplace'. Currently, the caller has to URL encode the submission to the api.WriteWorkersKV() call to ensure the slashes get through.

I can't think of a situation where we wouldn't want to URL encode a key as soon as the user submits it - adding an encode would the right thing instead of passively allowing data loss.

* Adding net/url import

That's what I get for working in the browser - missed the import.

cloudflare/cloudflare-go,cloudflare/cloudflare-go