Detalhes do pacote

subtext

hapijs168.6kBSD-3-Clausedepreciado6.0.12

This module has moved and is now available at @hapi/subtext. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.

HTTP payload parsing

http, payload, file, stream

readme (leia-me)

subtext

HTTP payload parser.

Build Status

Lead Maintainer: Eran Hammer

subtext parses the request body and returns it in a promise.

Example

const Http = require('http');
const Subtext = require('subtext');

Http.createServer(async (request, response) => {

  const { payload, mime } = await Subtext.parse(request, null, { parse: true, output: 'data' });

  response.writeHead(200, { 'Content-Type': 'text/plain' });
  response.end(`Payload contains: ${JSON.stringify(payload)}`);

}).listen(1337, '127.0.0.1');

console.log('Server running at http://127.0.0.1:1337/');

API

See the API Reference

changelog (log de mudanças)