diff --git a/udsp/client/index.js b/udsp/client/index.js index a9a62fe2..4280ce3d 100644 --- a/udsp/client/index.js +++ b/udsp/client/index.js @@ -45,6 +45,7 @@ import { fetchRequest } from '../fetch.js'; import { UDSP } from '#udsp/base'; import { sendPacket } from '../sendPacket.js'; import { connect } from './connect.js'; +import { post } from '../post'; // UNIVERSAL WEB Client Class export class Client extends UDSP { constructor(configuration) { @@ -324,6 +325,7 @@ export class Client extends UDSP { } request = request; fetch = fetchRequest; + post = post; processMessage = processMessage; emit = emit; onListening = onListening; diff --git a/udsp/post.js b/udsp/post.js new file mode 100644 index 00000000..41912933 --- /dev/null +++ b/udsp/post.js @@ -0,0 +1,15 @@ +import { + success, failed, imported, msgSent, info +} from '#logs'; +import { promise, construct, isString } from '@universalweb/acid'; +imported('Request'); +export async function post(url, data, options = {}) { + info(`POST => ${url}`); + options.method = 'post'; + const source = { + url, + data, + }; + const request = await this.request(source, options); + return request.send(); +}