Answer
URL-encode the = and & characters within the string being constructed — use %3D in place of a literal = and %26 in place of a literal & — rather than using those characters literally in the built string. The raw = and & characters are being interpreted specially in that context rather than treated as plain literal text, and encoding them avoids the truncation.