How to pass a very long string to the background server? (in the case of vue's axios+nodejs+express)

I now need to pass a string of special length to the background server, as shown in figure

{"c":1549473758948,"e":253402300799000,"v":"[{\"id\":1,\"fileName\":\"2016_Book_PsychometricFrameworkForModeli\",\"cover\":\"http://192.168.1.102:5070/img/Education/2016_Book_PsychometricFrameworkForModeli.jpeg\",\"title\":\"Psychometric Framework for Modeling Parental Involvement and Reading Literacy\",\"author\":\"Annemiek Punter, Cees A. W. Glas and Martina R. M. Meelissen\",\"publisher\":\"Springer International Publishing, Cham\",\"bookId\":\"2016_Book_PsychometricFrameworkForModeli\",\"category\":4,\"categoryText\":\"Education\",\"language\":\"en\",\"rootFile\":\"OEBPS/content.opf\",\"selected\":false,\"cache\":false,\"haveRead\":0,\"type\":1},{\"type\":4,\"cache\":true,\"selected\":false,\"fileName\":\"2013_Book_ManagingRiskAndInformationSecu\",\"title\":\"2013_Book_ManagingRiskAndInformationSecu\",\"id\":2},{\"id\":3,\"fileName\":\"2016_Book_SecondaryAnalysisOfElectronicH\",\"cover\":\"http://192.168.1.102:5070/img/MedicineAndPublicHealth/2016_Book_SecondaryAnalysisOfElectronicH.jpeg\",\"title\":\"Secondary Analysis of Electronic Health Records\",\"author\":\"MIT Critical Data\",\"publisher\":\"Springer International Publishing, Cham\",\"bookId\":\"2016_Book_SecondaryAnalysisOfElectronicH\",\"category\":17,\"categoryText\":\"MedicineAndPublicHealth\",\"language\":\"en\",\"rootFile\":\"OEBPS/content.opf\",\"selected\":false,\"cache\":false,\"haveRead\":0,\"type\":1},{\"type\":4,\"cache\":true,\"selected\":false,\"fileName\":\"2017_Book_IntelligentHumanComputerIntera\",\"title\":\"2017_Book_IntelligentHumanComputerIntera\",\"id\":4},{\"type\":4,\"cache\":true,\"selected\":false,\"fileName\":\"2018_Book_TheHuaweiAndSnowdenQuestions\",\"title\":\"2018_Book_TheHuaweiAndSnowdenQuestions\",\"id\":5},{\"id\":6,\"itemList\":[{\"id\":1,\"fileName\":\"2018_Book_DiseasesOfTheAbdomenAndPelvis2\",\"cover\":\"http://192.168.1.102:5070/img/MedicineAndPublicHealth/978-3-319-75019-4_CoverFigure.jpg\",\"title\":\"Diseases of the Abdomen and Pelvis 20182021\",\"author\":\"Juerg Hodler\",\"publisher\":\"Springer International Publishing\",\"bookId\":\"2018_Book_DiseasesOfTheAbdomenAndPelvis2\",\"category\":17,\"categoryText\":\"MedicineAndPublicHealth\",\"language\":\"en\",\"rootFile\":\"OEBPS/package.opf\",\"selected\":true,\"cache\":false,\"haveRead\":0,\"type\":1},{\"id\":2,\"fileName\":\"2016_Book_AHistoryOfRadionuclideStudiesI\",\"cover\":\"http://192.168.1.102:5070/img/MedicineAndPublicHealth/978-3-319-28624-2_CoverFigure.jpg\",\"title\":\"A History of Radionuclide Studies in the UK\",\"author\":\"Ralph McCready\",\"publisher\":\"Springer International Publishing\",\"bookId\":\"2016_Book_AHistoryOfRadionuclideStudiesI\",\"category\":17,\"categoryText\":\"MedicineAndPublicHealth\",\"language\":\"en\",\"rootFile\":\"OEBPS/package.opf\",\"selected\":true,\"cache\":false,\"haveRead\":0,\"type\":1},{\"id\":3,\"fileName\":\"2016_Book_PublicHealthEthicsCasesSpannin\",\"cover\":\"http://192.168.1.102:5070/img/MedicineAndPublicHealth/2016_Book_PublicHealthEthicsCasesSpannin.jpeg\",\"title\":\"Public Health Ethics: Cases Spanning the Globe\",\"author\":\"Drue H. Barrett, Leonard W. Ortmann, Angus Dawson, Carla Saenz, Andreas Reis and Gail Bolan\",\"publisher\":\"Springer International Publishing, Cham\",\"bookId\":\"2016_Book_PublicHealthEthicsCasesSpannin\",\"category\":17,\"categoryText\":\"MedicineAndPublicHealth\",\"language\":\"en\",\"rootFile\":\"OEBPS/content.opf\",\"selected\":true,\"cache\":false,\"haveRead\":0,\"type\":1}],\"selected\":false,\"title\":\"test\",\"type\":2},{\"id\":7,\"fileName\":\"2018_Book_SecurityInComputerAndInformati\",\"cover\":\"http://192.168.1.102:5070/img/ComputerScience/978-3-319-95189-8_CoverFigure.jpg\",\"title\":\"Security in Computer and Information Sciences\",\"author\":\"Erol Gelenbe\",\"publisher\":\"Springer International Publishing\",\"bookId\":\"2018_Book_SecurityInComputerAndInformati\",\"category\":1,\"categoryText\":\"ComputerScience\",\"language\":\"en\",\"rootFile\":\"OEBPS/package.opf\",\"selected\":false,\"cache\":false,\"haveRead\":0,\"type\":1},{\"id\":8,\"fileName\":\"2018_Book_ComplicationsAndQuandariesInTh\",\"cover\":\"http://192.168.1.102:5070/img/Laws/2018_Book_ComplicationsAndQuandariesInTh.jpeg\",\"title\":\"Complications and Quandaries in the ICT Sector\",\"author\":\"Ashish Bharadwaj, Vishwas H. Devaiah and Indranath Gupta\",\"publisher\":\"Springer Singapore, Singapore\",\"bookId\":\"2018_Book_ComplicationsAndQuandariesInTh\",\"category\":9,\"categoryText\":\"Laws\",\"language\":\"en\",\"rootFile\":\"OEBPS/content.opf\",\"selected\":false,\"cache\":false,\"haveRead\":0,\"type\":1},{\"id\":-1,\"type\":3}]"}

but after I send it to the background, I print out only half the length, and then display undefined

clipboard.png

axios Code:

app.post("/local", (req, res) => {
  req.on("data", data => { 
    // post
    let formData = decodeURIComponent(data)   // 
    // let param = qs.parse(formData)
    let param = querystring.parse(formData)   // object
    console.log(param.shelf)
  })
})

before querying some configurations (useless, only half of the data accepted by the server is printed.)

app.use(bodyParser.json({limit:"100mb"}));
app.use(bodyParser.urlencoded({ limit:"100mb", extended: true }));

I don"t know how to solve it. Has been bothering QAQ for a long time


post transfer size is unlimited. Get is available


I really can't split it up.

use FormData to test

use File to test

look at nodejs to see if you accept the same number of bytes each time.
observe whether the express setting accepts byte size is invalid

and why print it out? I don't know if that's the problem. I don't think so, whether it is or not, it is not right to do so! )
use IDE to see if the number of bytes matches


this is not long either. It should be far less than the restricted size

.

can you check the size of the body of request received? Maybe the console can't print it all.


original answer has been deleted


I have built a project and tried it, and the data can be received normally:

I can't find the problem for the time being. I uploaded the project to github. Please compare it.

https://github.com/MudOnTire/...

Menu