In the context of Data Services an unknown internal server error occurred occurred when HTTP requests were sent to the server using nodeJS from the client

After server-side debugging, the server did not correctly resolve the content-Type of the request at all. In postman scenarios, the correct parse content-Type is multipart/mixed:

The content-type is specified in the nodejs code.

After analyzing line after line of code, it turns out that the problem is the value of the JSON field on line 63. I mistakenly assigned true.

What does this parameter do? Just debug it. If true, go to line 403.

If the content-Type of an entity inside the request is not Application/X-www-form-urlencoded, line 1293 is entered.

The implementation logic of safeStringify is the browser’s native Json.stringify, which serializes JSON objects passed in by the application into strings. But in my code, the body of the request Module is a string, and the JSON parameter is set to true, so it is not logically correct. After changing the value of this JSON parameter to false, everything works fine.

For more of Jerry’s original articles, please follow the public account “Wang Zixi “: