Skip to content

Commit 11a7720

Browse files
committed
fix: use indices:dots arrayFmt in MarshalRoot for correct multipart array encoding
Changes arrayFmt from "comma" to "indices:dots" in MarshalRoot so that arrays of objects produce indexed field names (e.g. files.0.dest_path) instead of ambiguous repeated names (e.g. files.dest_path). This only affects the two MarshalMultipart callers that have array fields (BrowserFUploadParams, BrowserLoadExtensionsParams). The four callers without array fields are unaffected since the array encoder is never invoked. The objKeyEncoder also behaves identically for both formats (both use dot notation for nested objects). Made-with: Cursor
1 parent 09185d3 commit 11a7720

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

internal/apiform/encoder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func MarshalRoot(value any, writer *multipart.Writer) error {
3030
e := &encoder{
3131
root: true,
3232
dateFormat: time.RFC3339,
33-
arrayFmt: "comma",
33+
arrayFmt: "indices:dots",
3434
}
3535
return e.marshal(value, writer)
3636
}

0 commit comments

Comments
 (0)