fix(client): only send gzip if it's smaller
This commit is contained in:
parent
5ac8041f19
commit
12f564cc6d
|
@ -112,13 +112,26 @@ public class Plugin : IDalamudPlugin {
|
|||
await gz.FlushAsync();
|
||||
}
|
||||
|
||||
var req = new HttpRequestMessage(HttpMethod.Post, "https://map.anna.lgbt/api/upload") {
|
||||
Content = new ByteArrayContent(mem.ToArray()) {
|
||||
var gzipped = mem.ToArray();
|
||||
|
||||
ByteArrayContent content;
|
||||
if (gzipped.Length < msgpack.Length) {
|
||||
content = new ByteArrayContent(gzipped) {
|
||||
Headers = {
|
||||
ContentType = new MediaTypeHeaderValue("application/msgpack"),
|
||||
ContentEncoding = { "gzip" },
|
||||
},
|
||||
},
|
||||
};
|
||||
} else {
|
||||
content = new ByteArrayContent(msgpack) {
|
||||
Headers = {
|
||||
ContentType = new MediaTypeHeaderValue("application/msgpack"),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
var req = new HttpRequestMessage(HttpMethod.Post, "https://map.anna.lgbt/api/upload") {
|
||||
Content = content,
|
||||
};
|
||||
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue