mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
Add independent maxBodyLength option (#2781)
* Add independent option to set the maximum size of the request body * Remove maxBodyLength check * Update README * Assert for error code and message
This commit is contained in:
@@ -171,8 +171,8 @@ module.exports = function httpAdapter(config) {
|
||||
transport = isHttpsProxy ? httpsFollow : httpFollow;
|
||||
}
|
||||
|
||||
if (config.maxContentLength && config.maxContentLength > -1) {
|
||||
options.maxBodyLength = config.maxContentLength;
|
||||
if (config.maxBodyLength > -1) {
|
||||
options.maxBodyLength = config.maxBodyLength;
|
||||
}
|
||||
|
||||
// Create the request
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = function mergeConfig(config1, config2) {
|
||||
'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
|
||||
'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
|
||||
'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',
|
||||
'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',
|
||||
'maxContentLength', 'maxBodyLength', 'validateStatus', 'maxRedirects', 'httpAgent',
|
||||
'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'
|
||||
];
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ var defaults = {
|
||||
xsrfHeaderName: 'X-XSRF-TOKEN',
|
||||
|
||||
maxContentLength: -1,
|
||||
maxBodyLength: -1,
|
||||
|
||||
validateStatus: function validateStatus(status) {
|
||||
return status >= 200 && status < 300;
|
||||
|
||||
Reference in New Issue
Block a user