kronos-interceptor-http-request
v3.2.10
Published
Interceptor to convert messages into multipart form data and back
Downloads
12
Maintainers
Readme
kronos-interceptor-http-request
Interceptor to convert messages into multipart form data and back
API Reference
transformMessageToRequestMessage(message) ⇒
Copies the fields 'info' and 'hops' into the new message. Then create a formdata object containing 'info', 'hops' and 'payload'. Stores the formdata object as the payload of the 'newMessage' object.
Kind: global function
Returns: newMessage The transformed message
| Param | Description | | --- | --- | | message | The message to transform |
unpackToMessage(request, forwardFunction) ⇒
Unpacks a message from a multipart http request
Kind: global function
Returns: Promise A promise with the result of the forwardFunction
| Param | Description | | --- | --- | | request | The incomming http request | | forwardFunction | The function to call with the new generated message. The function must return a Promise. If no 'forwardFunction' is given It will return the message in the promise |
install
With npm do:
npm install kronos-interceptor-http-request
license
BSD-2-Clause