📅  最后修改于: 2022-03-11 15:03:24.538000             🧑  作者: Mango
var hm = require('header-metadata');
var sm = require('service-metadata');
var um = require('url');
hm.current.set('content-type','application/xml');
hm.current.set('accept','application/json');
// create a context named `TRAXQT` if not exist
var ctx = session.name('DummyTest') || session.createContext('TRAXQT');
/* ----------------------------------------------------- */
/* setup variables from service context */
/* ----------------------------------------------------- */
var domain = sm.getVar('var://service/domain-name');
var iURL = sm.getVar('var://service/URL-in');
/* ----------------------------------------------------- */
/* setup the logger based on which domain we are in */
/* ----------------------------------------------------- */
var domain = sm.getVar('var://service/domain-name');
//var logger = console.options({'category':'LogCat_TRAXQT'});
console.log('Domain->'+domain)
if (domain == "default") logger = console.log('Inside default domain');
//console.log(hm.current.'content-type');
//console.log(hm.original.'content-type');
//console.log(hm.response.'content-type');
//var urlobj = um.parse("http://dummy.restapiexample.com/api/v1/employees"); //um.parse(iURL);
//logger.debug("urlobj[%s] pathname[%s]", urlobj, urlobj.pathname);
//var route = um.format(urlobj);
//sm.setVar('var://service/routing-url', route);
//logger.info("Route[%s]", route);