Skip to content
Snippets Groups Projects
Unverified Commit 8615a6fd authored by Sigmund, Dominik's avatar Sigmund, Dominik
Browse files

Change http to string

parent 3d61b94f
Branches
Tags
1 merge request!1Update index.test.js, examples/all-options.js, examples/log-to-file.js,...
const { RSA_NO_PADDING } = require('constants');
const { readdirSync } = require('fs');
var http = require('http'); var http = require('http');
http.createServer(function (req, res) { http.createServer(function (req, res) {
console.log(req.method, req.url) console.log(req.method, req.url)
...@@ -9,8 +7,8 @@ http.createServer(function (req, res) { ...@@ -9,8 +7,8 @@ http.createServer(function (req, res) {
body += data body += data
}) })
req.on('end', function() { req.on('end', function() {
console.log(JSON.parse(body)) console.log(body)
res.writeHead(200, {'Content-Type': 'text/html'}) res.writeHead(202, {'Content-Type': 'text/html'})
res.end('post received') res.end('post received')
}) })
......
...@@ -132,7 +132,7 @@ function Log (options) { ...@@ -132,7 +132,7 @@ function Log (options) {
level: this.levels[tag] level: this.levels[tag]
}) })
if (this.options.graylog.mode && this.options.graylog.mode === 'http') { if (this.options.graylog.mode && this.options.graylog.mode === 'http') {
this.request.post(this.options.graylog.server + ':' + this.options.graylog.port + '/gelf', {json: JSON.parse(data)}, (error, res, body) => { this.request.post(this.options.graylog.server + ':' + this.options.graylog.port + '/gelf', {body: data}, (error, res, body) => {
if (error) { if (error) {
console.error(error) console.error(error)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment