Resolved issue 7
This commit is contained in:
parent
d762fc1c15
commit
48d4c73ca3
@ -97,14 +97,15 @@ listeners.accounting.socket.bind (config.ports.radius_accounting);
|
|||||||
|
|
||||||
// HTTP listener
|
// HTTP listener
|
||||||
const respond = (res, content, status) => {
|
const respond = (res, content, status) => {
|
||||||
if (typeof (content) == "string") {
|
var type = "text/plain";
|
||||||
res.write (content);
|
if (typeof (content) != "string") {
|
||||||
|
content = JSON.stringify (content);
|
||||||
|
type = "application/json";
|
||||||
}
|
}
|
||||||
else {
|
res.writeHead (status, {
|
||||||
res.write (JSON.stringify (content));
|
"Content-Type": type,
|
||||||
}
|
"Content-Length": content.length
|
||||||
res.statusCode = status;
|
}).end (content);
|
||||||
res.end ();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
http.createServer (function (req, res) {
|
http.createServer (function (req, res) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user