Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

142
Views
www-form-urlencoded string parameter not recognized in API communication

It is difficult to give a reproducible exemple, I summarise here the main components:

We have a front-end/back-end system on an ubuntu 18.04 server. The client side is a web plateform where users can create a project with characteristics (like name, date...). The front-end is coded in javascript, with a mongoDB behind, and communicates with a flask API. The web link is managed by a dedicated web proxy.

We face a very puzzling behavior we don't understand after days of debugging:

The front-end sends a www-form-urlencoded string parameter X to the API. This parameter is optional and can be empty.

We check that this parameter is in the request body

let X = req.body.X? req.body.X : "";

If the parameter is set, the requests succeed. However, if the parameter is omitted a weird behavior happens in the API :

  • The HTTP request is received, we can read a few key properties such as requested URL, headers and such
  • When accessing the property request.form, a dict containing the parameters as key-value pairs, the API freezes.
  • After a short time the requests timesout frontEnd side
  • After the timeout, Flask resolves the request with a 400 BAD REQUEST code without raising any exception or calling a set error handler for the 400 code.
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

We eventually found the reason why it failed. I document it here for the next one: The development version used the 'got' library for the http request. For whatever reason (we are still investigating and I will complete the answer once we find more), the request with an empty string failed for 'got'. We switched to the 'axios' library and all went fine.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!