git » sdk » commit 0608d70

Make sure we send Content-Length

author Stephen Paul Weber
2025-04-14 18:07:00 UTC
committer Stephen Paul Weber
2025-04-14 18:07:00 UTC
parent 40dad6c3318242afb0baef4a5099ba3cf6f81ce3

Make sure we send Content-Length

snikket/Client.hx +1 -1

diff --git a/snikket/Client.hx b/snikket/Client.hx
index 0672a2e..ecb2c90 100644
--- a/snikket/Client.hx
+++ b/snikket/Client.hx
@@ -762,7 +762,7 @@ class Client extends EventEmitter {
 			if (slot == null) {
 				prepareAttachmentFor(source, services.slice(1), hashes, callback);
 			} else {
-				tink.http.Client.fetch(slot.put, { method: PUT, headers: slot.putHeaders, body: tink.io.Source.RealSourceTools.idealize(source.tinkSource(), (e) -> throw e) }).all()
+				tink.http.Client.fetch(slot.put, { method: PUT, headers: slot.putHeaders.concat([new tink.http.Header.HeaderField("Content-Length", source.size)]), body: tink.io.Source.RealSourceTools.idealize(source.tinkSource(), (e) -> throw e) }).all()
 					.handle((o) -> switch o {
 						case Success(res) if (res.header.statusCode == 201):
 							callback(new ChatAttachment(source.name, source.type, source.size, [slot.get], hashes));