API Elements: Multipart / Form data serializer
Usage
Async
const { Fury } = require('@apielements/core');
const formSerializer = require('@apielements/form-serializer');
const fury = new Fury();
fury.use(formSerializer);
const api = new namespace.elements.DataStructure(
new namespace.elements.String('Hello world')
);
const mediaType = 'multipart/form-data';
fury.serialize({ api, mediatype }, (error, body) => {
console.log(body);
});
Sync
const { Fury } = require('@apielements/core');
const formSerializer = require('@apielements/form-serializer');
const fury = new Fury();
fury.use(formSerializer);
const api = new namespace.elements.DataStructure(
new namespace.elements.String('Hello world')
);
const mediaType = 'multipart/form-data';
try {
const body = fury.serializeSync({ api, mediatype });
console.log(body);
} catch (error) {
console.log(error);
}