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.

There is no way to access request's raw body

See original GitHub issue

I implement an integration with Stripe, and need access to request’s raw body in order to verify signature (Stripe makes POST requests on specified webhook). I have found that in the source code:

connection.rawConnection.form = new formidable.IncomingForm()

for (i in api.config.servers.web.formOptions) {
  connection.rawConnection.form[i] = api.config.servers.web.formOptions[i]
}

connection.rawConnection.form.parse(connection.rawConnection.req, (error, fields, files) => {
  if (error) {
    server.log('error processing form: ' + String(error), 'error')
    connection.error = new Error('There was an error processing this form.')
  } else {
    connection.rawConnection.params.body = fields
    connection.rawConnection.params.files = files
    fillParamsFromWebRequest(connection, files)
    fillParamsFromWebRequest(connection, fields)
  }
  if (api.config.servers.web.queryRouting !== true) { connection.params.action = null }
  api.routes.processRoute(connection, pathParts)
  callback(requestMode)
})

As I understood, there is no way to access raw body via rawConnection object. Is there any other way (maybe suggestions) how to access it?

  • ActionHero Version: 16.0.0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
evantahlercommented, Jul 10, 2017

Got it! Check out https://github.com/actionhero/actionhero/pull/1082… I think this would solve your problem?

0reactions
evantahlercommented, Jul 13, 2017

closed by #1082

Read more comments on GitHub >

github_iconTop Results From Across the Web

Retrieve the raw request body · Issue #2255 · nock/nock · GitHub
I thought there was a way to access the raw request body but cannot recall it right now. Can you check the tests...
Read more >
How to get raw request body in ASP.NET? - Stack Overflow
InputStream is the answer. StreamReader.ReadToEnd should give you the string. If it is an empty string, that means there is no "body" in...
Read more >
Solved: How to Specify a Raw Body on a Custom Connector in...
Solved: Hi, I'm creating a Flow process that uses a custom connector to access an on-prem API using the data gateway. I'm on...
Read more >
Accepting Raw Request Body Content in ASP.NET Core API ...
When posting raw body content to ASP.NET Core the process is not very self-explanatory. There's no easy way to simply retrieve raw data...
Read more >
Request and response objects - Django documentation
If you need to access raw or non-form data posted in the request, access this through the HttpRequest.body attribute instead. It's possible that...
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