Skip to content

fmodata batch requests overwrite multipart Content-Type with application/json #229

@eluce2

Description

@eluce2

BatchBuilder.execute() sets the correct batch header, but FMServerConnection._makeRequestEffect() overwrites it with application/json, so all $batch calls fail against FileMaker OData.

Observed app error:

OData error: Batch operation requires multipart content type
code: -1014
url: https://.../fmi/odata/v4/.../$batch

Why this looks like library bug:

  • src/client/batch-builder.ts:191-199 sends:
    • Content-Type: multipart/mixed; boundary=${boundary}
    • OData-Version: 4.0
  • src/client/filemaker-odata.ts:275-277 later rebuilds headers and unconditionally does:
    • headers.set("Content-Type", "application/json")

That means batch requests lose the required multipart content type before fetch.

I checked npm @proofkit/fmodata@0.1.0-beta.41; same unconditional overwrite is still present in src/client/filemaker-odata.ts.

Expected:

  • preserve caller Content-Type when already set
  • or only default to application/json for non-batch JSON requests

Possible fix:

if (!headers.has("Content-Type")) {
  headers.set("Content-Type", "application/json");
}

or special-case $batch / multipart bodies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions