mirror of
https://github.com/google/nomulus
synced 2026-09-05 15:46:55 +00:00
Set the MIME type BEFORE the payload
When we set the payload, it is converted to bytes using the response's character set. Changing the MIME type later has no effect on the conversion to bytes, even though it does change the returned MIME type. This results in bytes that were encoded using one character set while the response reports a different character set. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=196258752
This commit is contained in:
@@ -60,6 +60,7 @@ public final class FakeResponse implements Response {
|
||||
|
||||
@Override
|
||||
public void setContentType(MediaType contentType) {
|
||||
checkArgument(payload.isEmpty(), "setContentType must be called before setPayload");
|
||||
this.contentType = checkNotNull(contentType);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user