Closed easel closed 8 years ago
I am afraid this is a byproduct of the heavy refactoring that was done for v1. The body used to be sent in plain text but this made charset encoding/decoding very tricky across platforms, especially for sending binary data. Hence the unused charset
variables in all three drivers (you should remove those from BrowserDriver and the jvm driver as well).
In fact, CrossPlatformUtils.oneByteCharset
has become irrelevant. All three platform support ISO-8859-1
for decoding so this should be defined as a constant in HttpUtils
(serves a similar purpose as CrossPlatformUtils
except for shared code) and used in HttpResponse
. ~~Unfortunately we can not use 'utf-8' by default as it is not supported by the browser for some strange reasons.
If not defaulting to UTF-8 is an issue, the user has access to the raw body and can decode with whatever charset he wants.Or the default charset could be configurable but this should go in a separate feature request if there is a need for it.~~
Actually I don't remember if the issue with UTF-8 was also related to upload. If the tests pass with UTF-8, then we should definitely use UTF-8 as default.
Yeah I was going to ask about UTF-8. As far as I am concerned, we should force UTF-8 down everybody's throat and deal with the fallout via configuration. I've been able to get away with that approach fairly successfully for the last few years -- I'd be surprised if we ran into significant issues doing it here too.
we should force UTF-8 down everybody's throat
LMAO that is so true.
Turns out that the js-side parser blows up when no content-type header is provided, such as below. I haven't figured out how to make express produce such output in the tests, but this is the default you'll get using play with a simple BadRequest() response.
The stack trace looks like this: