Answer the question
In order to leave comments, you need to log in
Postpone, prevent NodeJs POST acceptance?
In general , the situation is as follows:
Only the admin (let's say) can contact the server with a post request and different maximum request sizes can be applied to different apishkas. (you can upload files or not).
Problem:
When making a request to the server, it needs time to think (to see what kind of apishka should be called, check the user's permissions ... and so on), and it starts accepting the request immediately .... (I think so (or not ?? ?)).
Question:
It is possible to somehow delay the reception of the post, and then either ban it or limit it (mb). Maybe there is some other way to handle this situation?
P.S. I don't use frameworks and don't plan to (yet :)
P.S.S. I will be glad to any advice.
Answer the question
In order to leave comments, you need to log in
var request = require('request');
var newRequest = request
(
{
method: 'GET',
url: //Ваш URL
}
);
newRequest.pause();
newRequest.on('response', function(resp)
{
if(resp.statusCode === 200)
{
newRequest.resume();
}
else
{
console.log('Что-то не так');
newRequest.end();
}
});
newRequest.on('data', function(chunk)
{
answer += chunk;
});
newRequest.on('end', function()
{
console.log('Получили данные');
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question