http: minor fixes.

This commit is contained in:
Christopher Jeffrey 2017-10-07 13:51:47 -07:00
parent 86746e2bd0
commit aeb3d8f352
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
3 changed files with 8 additions and 3 deletions

View File

@ -59,6 +59,7 @@ function LowlevelUp(backend, location, options) {
LowlevelUp.prototype.init = function init() {
const Backend = this.backend;
let db = new Backend(this.location);
let binding = db;

View File

@ -366,6 +366,7 @@ HTTPBase.prototype.readBody = function readBody(req, enc, options) {
HTTPBase.prototype._readBody = function _readBody(req, enc, options, resolve, reject) {
const decode = new StringDecoder(enc);
let hasData = false;
let total = 0;
let body = '';
@ -1256,6 +1257,7 @@ Request.prototype.init = function init(req, res, url) {
Request.prototype.parse = function parse(url) {
const uri = URL.parse(url);
let pathname = uri.pathname;
let query = Object.create(null);
let trailing = false;

View File

@ -380,7 +380,7 @@ HTTPServer.prototype.initRouter = function initRouter() {
this.post('/:id/send', async (req, res) => {
const valid = req.valid();
const passphrase = valid.str('passphrase');
const outputs = valid.array('outputs');
const outputs = valid.array('outputs', []);
const options = {
rate: valid.u64('rate'),
@ -397,6 +397,7 @@ HTTPServer.prototype.initRouter = function initRouter() {
for (const output of outputs) {
const valid = new Validator([output]);
const raw = valid.buf('script');
let script = null;
if (raw)
@ -420,7 +421,7 @@ HTTPServer.prototype.initRouter = function initRouter() {
this.post('/:id/create', async (req, res) => {
const valid = req.valid();
const passphrase = valid.str('passphrase');
const outputs = valid.array('outputs');
const outputs = valid.array('outputs', []);
const options = {
rate: valid.u64('rate'),
@ -436,6 +437,7 @@ HTTPServer.prototype.initRouter = function initRouter() {
for (const output of outputs) {
const valid = new Validator([output]);
const raw = valid.buf('script');
let script = null;
if (raw)
@ -870,7 +872,7 @@ HTTPServer.prototype.handleSocket = function handleSocket(socket) {
socket.auth = true;
this.logger.info('Successful auth from %s.', socket.host);
this.logger.info('Successful auth from %s.', socket.remoteAddress);
this.handleAuth(socket);