Search code examples
ruby-on-railsrubybase64ruby-on-rails-5puma

How I can send a large encoded base64 string to rails server API


I am trying to send large base64 encoded string from client to server rails API and then decode it on the server side and upload the file to S3 or any other service. Whilst I was trying to send large encoded base64 string I am facing the following error:

2018-01-12 14:39:51 +0530: HTTP parse error, malformed request (): #<Puma::HttpParserError: HTTP element QUERY_STRING is longer than the (1024 * 10) allowed length (was 53799)>
---

Since base 64 encoded string is very large. I am attaching screenshot please seeenter image description here

I am using rails 5.2 beta and puma server. Please let me know if I need to share any more informations or correct anything


Solution

  • As you can see here: What is the maximum possible length of a query string?

    Some clients may imply a limit for the query string.

    What you need to do, is to accept this string in the body of the request. Since your using Postman, you can do the following:

    post with body

    Rails by default will parser those values for value, and it'll be available on the @params hash.