| Did you know ... | Search Documentation: |
| Pack logtalk -- logtalk-3.101.0/docs/handbook/_sources/libraries/http_multipart.rst.txt |
.. _library_http_multipart:
http_multipart
This library provides a higher-level multipart helper layer on top of
the http_core library. It does not replace the low-level multipart
wire support already implemented in http_core; instead it wraps the
normalized multipart body and part terms, adds form-data field and file
helpers, and delegates raw parsing and generation to the existing
http_core predicates.
Open the `../../apis/library_index.html#http_multipart <../../apis/library_index.html#http_multipart>`__ link in a web browser.
To load the library, load the loader.lgt file:
::
| ?- logtalk_load(http_multipart(loader)).
To test this library, load the tester.lgt file:
::
| ?- logtalk_load(http_multipart(tester)).
The current version provides:
multipart/form-data body
from an ordered list of parameter-aware field and file descriptors.http_core::parse_body/4 and
http_core::generate_body/3 predicates.The parameter-aware helper predicates use the following descriptor shapes:
field(Name, Value, Parameters)file(Name, Filename, MediaType, Payload, Parameters)
In both cases, Parameters is an ordered list of extra
Content-Disposition: form-data parameters represented as
Name-Value pairs. The reserved name and filename parameters
remain explicit helper arguments and must not be repeated in the
Parameters list.
Additional Content-Disposition: form-data parameters are preserved
as ordered Name-Value pairs. Any special semantics for extended
parameters such as filename* are intentionally left to callers.
Multipart bodies use the normalized http_core body term:
::
content(MediaType, multipart(Parts))
Multipart parts use the recursive normalized term:
::
part(Headers, Body, Properties)
multipart/form-data body explicitly.http_client library can send common form-data requests
directly from a form_data(Items) descriptor.http_server_core library keeps multipart request bodies in the
normalized form expected by this library, so handlers can inspect
incoming multipart requests without reparsing them.Content-Type metadata or an explicit boundary/1
option, exactly as in the underlying http_core library.