Skip to content

Function: parseBatchBody()

parseBatchBody(body, boundary): ParsedBatch

Defined in: packages/core/src/batch/batch-parser.ts:61

Parse a multipart/mixed batch body into structured BatchPart objects.

Handles:

  • Individual request parts (kind: 'request')
  • Changesets (kind: 'changeset') containing sub-request parts
  • Both CRLF (\r\n) and LF (\n) line endings
  • Content-ID headers for changeset sub-parts
  • Embedded HTTP request parsing (METHOD URL HTTP/1.1, headers, body)

Per T-05-02: rejects batches exceeding MAX_BATCH_OPERATIONS operations.

Parameters

body

string

The raw request body string

boundary

string

The multipart boundary (from extractBoundary())

Returns

ParsedBatch

ParsedBatch with all parsed parts

Throws

ODataValidationError if body is malformed or exceeds limits