URLs are encoded being encoded to arrays it seems. #24
Comments
After some additional poking around. Could it be because this library doesn't support encoding/decoding URLs at all? |
@EmperiorEric which version of Vapor are you using?
We should add special support for |
Vapor 3.3.2 Yea I kept playing and eventually I threw this in and it worked without other changes. I know there is more to the change required to fully support it. So its not so much a bug as it is a missing feature I suppose.
|
@tanner0101 If I were to work on a PR to fix this, can I aim it at the master branch or do I need to build it for the unreleased v2 branch? |
The solution you posted looks good to me. For Vapor 3, target this against |
I'm sending data to Stripe which requests URLEncodedForm data instead of JSON. And I've run into a strange issue. All my properties of type
URL
are being sent as arrays. I worked backwards and it appears to be the encoding making a mistake.That prints out this:
As you can see, the JSON looks correct, single values for url, string, and int. But for the URLEncodedFormEncoder, url appears as an array. And sure enough when sending any URLs to Stripe, I'm getting an error back saying it expected a String but received an Array. I don't know much about URLEncodedForm data to know what the expected behavior actually is or how deep this bug goes.
Work Around
For the time being it appears the only work around is to abandon URL as a type and live with Strings only.
The text was updated successfully, but these errors were encountered: