I have a simple server and I need to access the request._body property. Unfortunately it always defaults to an empty string. The client does not have access to the response body either. My code snippets are below. Any help is appreciated.
Thanks
//server.js
const runtime = require('runtimejs')
const http = require('eshttp')
const server = new http.HttpServer()
const response = new HttpResponse(200, {'x-header': 'value'}, 'hello from the server')
server.onrequest = request => {
console.log('request body', request._body) // prints 'request body: '
request.respondWith(response)
}
server.listen(9000)
my client looks like this.
// client.js
const http = require('eshttp')
const HttpClient = http.HttpClient
const HttpRequest = http.HttpRequest
const client = new HttpClient('localhost', 9000)
const request = new HttpRequest('GET', '/', {'x-header': 'value'}, 'hello from the client')
client.request(request, (err res) => {
if (err) console.log(err)
console.log('response:', res._body) // prints 'response: undefined'
})
client.close()
I have a simple server and I need to access the
request._bodyproperty. Unfortunately it always defaults to an empty string. The client does not have access to the response body either. My code snippets are below. Any help is appreciated.Thanks
my client looks like this.