question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reading raw data doesn't appear to work

See original GitHub issue

Surely I’m doing something wrong, but this isn’t working for me:

'use strict';
const koa = require('koa');
const bodyParser = require('koa-bodyparser');

const app = koa();
app.use(bodyParser({
  enableTypes: ['text']
}));
app.use(function *() {
  this.body = this.request.body;
});
app.listen(3000);
$ curl -v --data 'Hello world' localhost:3000
* Rebuilt URL to: localhost:3000/
* Hostname was NOT found in DNS cache
*   Trying ::1...
* Connected to localhost (::1) port 3000 (#0)
> POST / HTTP/1.1
> User-Agent: curl/7.37.1
> Host: localhost:3000
> Accept: */*
> Content-Length: 11
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 11 out of 11 bytes
< HTTP/1.1 200 OK
< Content-Type: application/json; charset=utf-8
< Content-Length: 2
< Date: Thu, 19 May 2016 03:29:36 GMT
< Connection: keep-alive
<
* Connection #0 to host localhost left intact
{}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
dead-horsecommented, May 19, 2016

try this:

bodyparser({
  extendTypes: {
    text: ['application/xml'],
  },
  enableTypes: ['text'],
})
0reactions
wesley-firewallacommented, Mar 4, 2020

try this:

bodyparser({
  extendTypes: {
    text: ['application/xml'],
  },
  enableTypes: ['text'],
})

it should be

bodyparser({
  extendTypes: {
    text: ['application/xml'],
  },
  enableTypes: ['json', 'text'],
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

Reading Raw Data - SAS Help Center
When you read raw data with a DATA step, you can use a ... Unlike some languages, SAS does not read trailing blanks...
Read more >
What to do If the Hard Disk is Recognized as RAW - iFixit
If the reason for RAW file system to appear is wrong disconnection of the disk (or a power failure/shutdown in an incorrect way...
Read more >
What To Do When Your RAW File Cannot be Read ... - YouTube
If you buy a newly released camera, you may find that the RAW files from that camera cannot be read by your post...
Read more >
Reading Raw Data in SAS Or R - Stack Overflow
UPDATE FOR UPDATED QUESTION: The variables from the raw data file must be listed in the INPUT statment in the same order as...
Read more >
What is raw data and how does it work? - TechTarget
Raw data, in data management, is the collection of information as gathered by the source before it has been further processed, cleaned or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found