-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
specifying charset for body content? #926
Comments
Unfortunately I'm getting the idea that this is indeed a defect, after reading e.g. #567 . Look at all the Java APIs from Ideally you should have a Having a |
To better explain the problem, I wonder what charset this would use to encode the bytes? when()
.contentType("text/plain; charset=ISO-2022-JP")
.body("もしもし")
… Would the body be encoded in ISO-2022-JP? Or UTF-8? (How would I know? The documentation doesn't seem clear on this point.) My fear is that neither would happen, and that REST Assured might in fact just use the system default charset---which might be Cp1251 for all we know (as @mkotsur might be using in mkotsur/restito#66 ). |
If you specify a charset explicitly in the contentType that charset should be used. If charset is not explicitly specified REST Assured will query the config to check which charset to use. You can specify either the default charset (which defaults to ISO_8859_1 all content-types (except JSON which using UTF-8) as defined by Apache Http Client in |
What charset do methods such as RequestSpecification.body(String body) use? Because you have to be using some charset to convert a string to bytes.
Surely you aren't using the default system charset --- this would be a defect, as tests would not be reliable nor repeatable because you have no idea what charset the system is using.
From the API it seems that there is a big problem here --- you should be allowing the user to indicate the charset to use.
The text was updated successfully, but these errors were encountered: