Project

Profile

Help

Feature #4735

open

Add multipart support in HTTP client

Added by Debbie Lockett over 3 years ago. Updated almost 2 years ago.

Status:
New
Priority:
Low
Category:
IXSL extensions
Sprint/Milestone:
Start date:
2020-09-14
Due date:
% Done:

0%

Estimated time:
Applies to JS Branch:
2
Fix Committed on JS Branch:
Fixed in JS Release:
SEF Generated with:
Platforms:
Company:
-
Contact person:
-
Additional contact persons:
-

Description

As documented, multipart HTTP requests and responses are not currently supported properly by the Saxon-JS HTTP client (ixsl:schedule-action/@http-request).

See https://www.saxonica.com/saxon-js/documentation/index.html#!development/http :

Note that multipart HTTP requests are not currently implemented. Some rules anticipate these being available.

Multipart responses are not currently properly handled. A multipart response will be returned as one text/plain body in body (rather than an array of body parts in multipart-bodies.)

It has always been on the todo list to extend the support for multipart HTTP messages, but there has been no progress on this for some time.

The lack of support is an issue for sending FormData by HTTP. See notes #4732#note-4 and #4732#note-6 in Issue Support #4732: Upgrading AtomGraph application from Saxon-CE to Saxon-JS 2.

Actions #1

Updated by Debbie Lockett over 3 years ago

For the specific problem with sending FormData by HTTP (as raised in Support issue #4732), there is a JavaScript work around which could be an option, except it is not currently possible with the Saxon-JS HTTP client (ixsl:schedule-action/@http-request).

Usually to send FormData as the request body, the media-type should be multipart/form-data, and the boundary must be set. (See https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST)

A JavaScript work around for sending FormData is to not set the Content-Type header explicitly, but rather to leave it undefined and to let XMLHttpRequest in the browser set it to supply the boundary automatically (see https://stackoverflow.com/questions/40351429/formdata-how-to-get-or-set-boundary-in-multipart-form-data-angular).

However this is not possible with ixsl:schedule-action/@http-request, because here the media-type is mandatory (in the supplied $request map).

We should review this condition, since even in the absence of full support for multipart HTTP requests, making media-type optional could allow support for sending FormData.

Actions #2

Updated by Community Admin about 3 years ago

  • Applies to JS Branch 2 added
  • Applies to JS Branch deleted (2.0)
Actions #3

Updated by Norm Tovey-Walsh almost 2 years ago

  • Sprint/Milestone set to SaxonJS 3.0
Actions #4

Updated by Norm Tovey-Walsh almost 2 years ago

N.B. I know of at least one user who's working around this limitation in POJS.

Please register to edit this issue

Also available in: Atom PDF Tracking page