{"id":42203,"library":"ut-port-http","title":"UT Port HTTP","description":"HTTP/HTTPS client port module for the UT framework, built on top of the 'request' library. Current stable version is 8.9.9. It provides a configurable HTTP client for making web service requests with features like TLS support, response parsing (JSON/XML), timeouts, custom headers, and message transformation via send/receive hooks. Part of the UT ecosystem, it integrates tightly with UT's bus architecture. Compared to using 'request' or 'axios' directly, it offers a structured configuration format and automatic error handling tailored for microservice communication. Release cadence is irregular, tied to UT framework updates.","status":"active","version":"8.9.9","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/softwaregroup-bg/ut-port-http","tags":["javascript"],"install":[{"cmd":"npm install ut-port-http","lang":"bash","label":"npm"},{"cmd":"yarn add ut-port-http","lang":"bash","label":"yarn"},{"cmd":"pnpm add ut-port-http","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This is a CommonJS module; default export is a function that creates a port instance. ESM import may not work without a bundler.","wrong":"import portHttp from 'ut-port-http';","symbol":"portHttp","correct":"const portHttp = require('ut-port-http');"},{"note":"The module exports a factory function directly, not a class or create method.","wrong":"const httpPort = require('ut-port-http').create({ url: 'http://example.com' });","symbol":"config","correct":"const httpPort = require('ut-port-http')({ id: 'myPort', url: 'http://example.com', uri: '/api', method: 'post' });"},{"note":"The module expects a config object exported from a .js file; send/receive are methods on that config. Arrow functions are fine in modern Node.","wrong":"module.exports = { send: (msg) => msg }","symbol":"send","correct":"module.exports = { id: 'myPort', type: 'http', url: 'http://example.com', send: function(msg) { return msg; } }"}],"quickstart":{"code":"// example-config.js\nconst portHttp = require('ut-port-http');\n\nmodule.exports = {\n    id: 'myHttpPort',\n    type: 'http',\n    logLevel: 'debug',\n    url: 'http://jsonplaceholder.typicode.com',\n    uri: '/posts/1',\n    method: 'get',\n    receive: function(msg) {\n        if (msg.$$ && msg.$$.mtid === 'error') return msg;\n        msg.payload = JSON.parse(msg.payload);\n        return msg;\n    },\n    send: function(msg) {\n        return msg;\n    },\n    start: function() {\n        console.log('HTTP port started');\n    }\n};","lang":"javascript","description":"Shows a basic HTTP port configuration using ut-port-http, with common options like URL, method, and transforming the response."},"warnings":[{"fix":"Consider migrating to a port that uses 'node-fetch' or 'axios' if possible, or pin to a supported version of 'request'.","message":"The underlying 'request' module is deprecated as of 2020. ut-port-http depends on it, which may lead to security and compatibility issues.","severity":"deprecated","affected_versions":">=8.0.0"},{"fix":"Always return msg from receive, even on error: if(msg.$$.mtid === 'error') return msg;","message":"The receive function must return the message object; if not, subsequent handlers may break.","severity":"gotcha","affected_versions":">=8.0.0"},{"fix":"Include 'type': 'http' in the module.exports object.","message":"The configuration object must have 'type: http' explicitly; otherwise the port may not be recognized as HTTP.","severity":"gotcha","affected_versions":">=8.0.0"},{"fix":"Update receive functions to read msg.payload and msg.httpStatus instead of msg.body.","message":"In version 8, the response format changed: previously 'body' now wrapped under 'payload' and 'httpStatus'. Legacy code expecting 'body' property will break.","severity":"breaking","affected_versions":">=8.0.0"},{"fix":"Ensure compatible parsers are installed (e.g., xml2js) or set parseResponse to false and handle parsing manually.","message":"Setting 'parseResponse' to true but lacking a parser for the content type (e.g., XML) will throw an error.","severity":"gotcha","affected_versions":">=8.0.0"}],"env_vars":null,"search_vec":"'8.9.9':23 'architectur':64 'automat':79 'axio':70 'built':12 'bus':63 'cadenc':87 'client':5,29 'communic':85 'compar':65 'configur':27,76 'current':19 'custom':44 'direct':71 'ecosystem':56 'error':80 'featur':36 'format':77 'framework':11,93 'handl':81 'header':45 'hook':51 'http':3,28 'http/https':4 'integr':58 'irregular':89 'javascript':95 'json/xml':42 'librari':18 'like':37 'make':31 'messag':47 'microservic':84 'modul':7 'offer':73 'pars':41 'part':52 'port':2,6 'provid':25 'releas':86 'request':17,34,68 'respons':40 'send/receive':50 'servic':33 'stabl':20 'structur':75 'support':39 'tailor':82 'tie':90 'tight':59 'timeout':43 'tls':38 'top':14 'transform':48 'updat':94 'use':67 'ut':1,10,55,61,92 'version':21 'via':49 'web':32","created_at":"2026-06-04T18:56:07.252932+00:00","updated_at":"2026-06-04T18:56:07.252932+00:00","problems":[{"fix":"Run: npm install request","cause":"Missing dependency: 'request' is a peer dependency that must be installed separately.","error":"Error: Cannot find module 'request'"},{"fix":"Ensure the port is used within a UT application context (e.g., ut-run).","cause":"The 'start' function expects the port to be registered in a UT bus; standalone use fails.","error":"TypeError: this.bus.importMethod is not a function"},{"fix":"Check for msg.$$ existence: if(msg.$$ && msg.$$.mtid === 'error') return msg;","cause":"The receive function accesses msg.$$.mtid but msg.$$ is undefined when response is not an error.","error":"TypeError: Cannot read property 'mtid' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/softwaregroup-bg/ut-port-http#readme","github":"ssh://git@github.com/softwaregroup-bg/ut-port-http","docs":null,"changelog":null,"pypi":null,"npm":"ut-port-http","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}